因此,在将视图控制器推送到tableView后立即执行,
// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here --
// for example, create and push another view controller.
AnotherViewController *anotherViewController =
[[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
[self.navigationController pushViewController:anotherViewController animated:YES];
好的,这样可以使另一个视图滑动,您可以通过单击导航栏左上角自动显示的按钮返回上一个视图("pop"当前视图) .
好的,所以说我想用DONE按钮填充导航栏的右侧,就像iPhone附带的“Notes”应用程序一样 . 我该怎么办?
我试过这样的代码:
UIBarButtonItem * doneButton =
[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector( doneFunc ) ];
self.navigationController.navigationItem.rightBarButtonItem = doneButton ; // not it..
[doneButton release] ;
已定义doneFunc,并且所有内容,只是按钮永远不会出现在右侧..
2 回答
我认为你发布的代码应该可以正常工作 . 问题是,你把它放在哪里了?我会把它放到视图控制器的
-viewDidLoad
方法中,然后你可以在-viewWillAppear:
方法中显示它 .Update :实际上,我认为你需要改变
至
啊 . 你必须做:
谁先打败了它 .