[英]iOS Navigation Bar not visible
在我的應用程序中,我試圖通過AppCoda tut實現SideBar。 我在我的應用程序中添加了RevealViewController
, SideBarViewController
和NavigationController
。 鏈接我的主頁即初始視圖控制器ChatViewController
與NavContrl。 ChatViewController - 在故事板中檢查初始視圖控制器,因此無需任何初始化即可自動進行。 在NavigationController下我可以看到“ Relationship "root view controller to Chats"
。在NavigationItem
ChatViewController中我添加了標題和左鍵。如果我在NavigationControlelr中更改了NavBar的顏色,我可以看到ChatViewController NavItem中的反射。這都說明了,它是正確的。
在ChatViewController.m中,我添加了:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.edgesForExtendedLayout = UIRectEdgeNone;
self.sidebarButton.tintColor = [UIColor colorWithRed:0.100f green:0.100f blue:0.100f alpha:0.2f]; //colorWithWhite:0.96f alpha:0.2f];
//_sidebarButton.target = self.revealViewController;
//_sidebarButton.action = @selector(revealToggle:);
UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(revealToggle:)];
[self.view addGestureRecognizer:gesture];
}
-(void)viewDidAppear:(BOOL)animated {
//self.navigationController.navigationBarHidden = YES;
// YES or NO makes no differ
在運行時,我看不到NavBar,Title,左鍵任何東西。 它們只是視圖頂部的空白區域,但甚至不是NavBar或其他任何顏色。 任何人都可以幫我知道什么是錯的,為什么我無法看到NavigationBar。
我昨天被困在這里。 無法找到解決此問題的方法。 任何幫助都非常感謝。 謝謝。
更新: - 故事板Scrn拍攝
在SWLRevalViewController
設置root controller
,就像
bz您的Root Controller
是在SWLRevalViewController
啟動的, SWLRevalViewController
不是Chat View Controller
更改它
這是U的示例項目,試試這是項目鏈接
https://www.sendspace.com/file/cte6n7
最后想要刪除項目的鏈接使用這個
https://www.sendspace.com/delete/cte6n7/83ec66ba3781cc584068addc0aec11c6
遇到了同樣的問題,雖然來晚了,但解決方
只需將每個目標視圖控制器中的每一個嵌入到導航控制器中。 如果視圖控制器不是 導航控制器的子節點,則必須隱藏 導航欄 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.