因此,推視圖控制器我的tableView,如何在推入另一個視圖控制器後將按鈕添加到我的navigationController的右側?
// 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];
好了,這樣就使得另一觀看幻燈片,您可以通過點擊返回到上一個視圖(「彈出」當前視圖)後立即自動現在出現在導航欄的左上角。
好的,所以說我想用DONE按鈕填充導航欄的右側,就像在iPhone附帶的「Notes」應用程序中一樣。我會怎麼做?
我想這樣的代碼:
UIBarButtonItem * doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneFunc) ]; self.navigationController.navigationItem.rightBarButtonItem = doneButton ; // not it.. [doneButton release] ;
doneFunc定義,和一切,只是按鈕永遠不會出現在右側..
你應該已經接受了托馬斯的答案,而不是你自己的答案。 – titaniumdecoy 2010-12-18 00:20:24