How to navigate to a nib(view) when a cell is pressed on a UITableView(on another nib/view)?
I want the functionality similar to the last tabs in a tab bar (those that are shown in a table after pressing the "..." )
Each points to another view.
My table
page a>
page b>
page c>
I guess that the code sh开发者_开发技巧ould be in didSelectRowAtIndexPath but
- I dont know how to call a nib based on the table
- I dont know if after navigating to the next nib ... I'll be able to navigate back
Thanks Asaf
copy&paste from random project:
-(void)navigateToFAQ
{
UIViewController *faqBrowser = [[UIViewController alloc] autorelease];
[faqBrowser initWithNibName:@"faqBrowser" bundle:nil];
// EDIT: sorry, leave this out this is my own category to UIBarButtonItem!
//faqBrowser.navigationItem.leftBarButtonItem = [UIBarButtonItem arrowLeftWithText:@"back" target:self action:@selector(dismiss)];
[self.navigationController pushViewController:faqBrowser animated:YES];
faqBrowser.title = @"FAQ";
}
-(void)dismiss
{
[self.navigationController popViewControllerAnimated:YES];
}
call [self navigateToFaq]
from your didSelectRowAtIndexPath
and make sure you have a nib file called faqBrowser.xib...
精彩评论