views:

102

answers:

1

I have a UITabBarController with more than 5 UITabBarItems so the moreNavigationController is available.

In my UITabBarController Delegate I do the following:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
//do some stuff
//...

UITableView *moreView = (UITableView *)self.tabBarController.moreNavigationController.topViewController.view;
    moreView.delegate = self;
}

I want to implement a UITableViewDelegate so I can capture the row that was selected, set a custom view property and then push the view controller:

- (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
  //how can I get the text of the cell here?
}

I need to get the text of a cell when the user taps on a row. How can I accomplish this?

A: 
- (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
      //how can I get the text of the cell here?
      UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
      NSString *str = cell.textLabel.text;
}
mihirpmehta