0
A
回答
0
使用此:
YourViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"YourViewController"];
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
[self.navigationController pushViewController:viewController animated:YES];
+0
先生。運行時返回錯誤UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate class])); –
0
我建議你使用代碼象下面這樣:
- (void)configureNavigationBarButtonItem
{
UIButton *cancel = [UIButton buttonWithType:UIButtonTypeCustom];
[cancel setFrame:CGRectMake(0, 0, 50, 50)];
[cancel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cancel.titleLabel setFont:[UIFont fontWithName:@"Verdana" size:13.0f]];
cancel.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
[cancel addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
cancel.tag=3200;
imgBack = [[UIImageView alloc]initWithFrame:CGRectMake(5, 15, 18, 18)];
imgBack.image = [UIImage imageNamed:@"back_black"];
[cancel addSubview:imgBack];
UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithCustomView:cancel];
self.navigationItem.leftBarButtonItem = cancelBtn;
}
- (void)goBack:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
相關問題
- 1. 問題隱藏導航欄
- 2. 如何隱藏導航欄?
- 3. 隱藏導航欄?
- 4. iOS9:在導航欄中隱藏SegmentedControl後不會出現標題
- 5. 如何在導航活動中隱藏藍色標題欄?
- 6. 從標籤欄控制器導航欄隱藏孩子的導航欄
- 7. 如何隱藏lightSlder的導航欄?
- 8. 如何使用Jquery隱藏導航欄?
- 9. 如何在android中隱藏導航欄?
- 10. 如何隱藏Ionic2中的導航欄
- 11. 如何通過CAAnimation隱藏導航欄?
- 12. 如何解決Bootstrap導航欄隱藏
- 13. 如何隱藏導航欄上的UIbarbutton
- 14. 隱藏導航欄旋轉
- 15. SFSafariViewController:隱藏導航欄
- 16. IPHONE:ABPeoplePickerNavigationController隱藏導航欄
- 17. Nativescript - 隱藏導航欄(IOS)
- 18. 隱藏標題欄
- 19. UITableViewController隱藏導航欄[搜索欄]
- 20. 如何創建pinterest風格隱藏/取消隱藏導航/標籤欄?
- 21. 隱藏導航欄的標題而不刪除它
- 22. 隱藏ActivityIndicator和顯示標題導航欄中
- 23. 隱藏導航欄和標題中的iframe
- 24. 如何隱藏searchController後解除導航欄
- 25. 導航欄圖片隱藏自定義導航欄按鈕
- 26. iOS導航欄:隱藏導航欄和平滑過渡
- 27. 如何限制UISearchController從隱藏視圖導航欄IOS8
- 28. 可能隱藏導航欄在標籤欄控制器?
- 29. 如何使用Xamarin隱藏「標題欄」
- 30. Back Bar Button Segue隱藏工具欄
嘗試這樣self.navigationItem.backBarButtonItem = [[的UIBarButtonItem頁頭] initWithTitle:@ 「」 樣式:UIBarButtonItemStylePlain目標:無行動:無]; –
'UINavigationController'已經爲你自動完成了。你只需要改變** previous **視圖控制器的'title'屬性。假設你有'vcA'和'vcB'視圖控制器,並且你從'vcA'推到'vcB'。帶有後退按鈕的'UINavigationBarItem'將在'vcB'中從'vcA'中取得標題並顯示出來。因此,如果您在推送前將空字符串設置爲'vcA'的標題,'vcB'中的後退按鈕也會顯示空字符串。 –