DetailView in TableView doesn't work (IOS)
I'm starting with a program that has a Tabbar controller with 4 buttons. On one of the pages there is a table view in the viewController. And when I click the row I want to push a DetailView. But nothing happens, no er开发者_如何学运维rors nothing???
Anybody an idea what can be wrong?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the selected item
NSString *selectedItem = [listOfItems objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
DetailViewController *myController = [[DetailViewController alloc]
initWithNibName:@"DetailViewController"
bundle:[NSBundle mainBundle]];
myController.title = @"Detail View";
myController.selectedItem = selectedItem;
[self.navigationController pushViewController:myController animated:YES];
[myController release];
}
Navigation to another View Controller is only can take place when your application supports UINavigation Controller. If It is there then secondly Your UITableViewDelegates are not there.
For this you need to have
tableView.delegate = self;
Or please elaborate your problem more
Are you sure you have set the UITabelViewDelegate
? If not please set the delegate of the UITableView
as
tableView.delegate = self;
Also make sure your header file implements the UITableViewDelegate
protocol
精彩评论