[英]iOS left UIBarButtonItem with custom view makes the default back button appear below
[英]iOS: Default Back button Being Presented Over Custom Left Nav Button
我發現了這個 ,一旦我推使用視圖: [self.navigationController pushViewController:viewController animated:YES];
我有在viewWillAppear中創建左側導航按鈕的代碼。 這是創建左側導航按鈕的代碼:
`UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 25)];
[leftButton setImage:[UIImage imageNamed:@"leftNavIconGray.png"] forState:UIControlStateNormal];
[leftButton setShowsTouchWhenHighlighted:TRUE];
[leftButton addTarget:self.navigationController.sideMenu action:@selector(toggleLeftSideMenu) forControlEvents:UIControlEventTouchDown];
UIBarButtonItem *barBackItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
self.navigationItem.hidesBackButton = TRUE;
self.navigationItem.leftBarButtonItem = barBackItem;
return;`
請注意,我確實在其中隱藏了后退按鈕。 由於左側導航按鈕在那里,因此將調用viewWillAppear,但是由於某種原因,默認隱藏的后退按鈕沒有被調用。
僅在按下視圖時才會發生這種情況,而在定期加載視圖時不會發生這種情況。
有誰知道如何使該后退按鈕離開那里?
我想你如果你的工作還沒有完成
只是隱藏導航欄
self.navController.navigationBarHidden = YES;
然后單擊leftButton(在toggleLeftSideMenu中)只需彈出視圖控制器
[self.navigationController popViewControllerAnimated:YES];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.