In My App I Create Everything Dynamically and i Create TabBar
with First Tab ( TableView
) i wanna Navigate When Pressing in Cell And I Write This Code In didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TripDetailView * TripDetailViewObjec = [[TripDetailView alloc]initWithNibName:@"TripDetailView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:TripDetailViewObjec animated:YES];
}
And self.navigationController=null
any help please ?
The navigation will not occur,because there is no navigationController
within the first Tab.For navigation to take place you need to embed navigation controller over your TableViewController.try the following to embed the navigationController
within the firstTab's TableView
in appDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UINavigationController * firstNavigationController = [[UINavigationController alloc]initWithRootViewController:yourTableViewController];
// temporarily just used one tab
//tabBarController should be already connected through NIB
[tabBarController setViewControllers:[NSArray arrayWithObjects:firstNavigationController,nil]];
self.window.rootViewController = tabBarController;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.