Ios – Push new view on clicking Table Cell, How’s that possible ?

iosiphoneobjective-cuitableviewuiview

I want to push a new view when the user select a cell on tableview, How it is possible ?

and that selected cell data i wanna to print on the new view ? give it to code me

Best Solution

Override this delegate methode of UItableViewDelegate.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Value Selected by user
      NSString *selectedValue = [displayValues objectAtIndex:indexPath.row];
//Initialize new viewController
      NewViewController *viewController = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
//Pass selected value to a property declared in NewViewController
      viewController.valueToPrint = selectedValue;
//Push new view to navigationController stack
      [self.navigationController pushViewController:viewController animated:YES];
}

See this links for more info
1) Table view tutorial
2) StackOverflow similar question