简体   繁体   中英

iOS Navigation Bar not visible

In my application I am trying to implement SideBar thru AppCoda tut . I added RevealViewController , SideBarViewController and and NavigationController in my app. Linked my main page ie the initial View Controller ChatViewController with the NavContrl. ChatViewController - Is Initial View Controller is checked in storyboard, so that comes auto without any initialization. Under NavigationController I can see " Relationship "root view controller to Chats" . In ChatViewController in NavigationItem I have added title and left button. If I change the color of NavBar in NavigationControlelr I can see the reflection in ChatViewController NavItem. This all tells, it is linked properly.

In ChatViewController.m, I have added :

- (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

While runtime, I don't see the NavBar, Title, left button anything. Their is just blank space on top of the view, but not even the color of NavBar or anything. Can anyone help me know what's wrong, why I am not able to see the NavigationBar.

I am stuck over here from yesterday. Can't find a solution for this problem. Any help is highly appreciated. Thanks.

UPDATE :- Storyboard Scrn shot 故事板全部4个视图

set the root controller in SWLRevalViewController ,just like 在此输入图像描述

bz your Root Controller is started in SWLRevalViewController not a Chat View Controller change this

this is the sample project for U, try this is the project link

https://www.sendspace.com/file/cte6n7

finally w want to delete the link of project use this

https://www.sendspace.com/delete/cte6n7/83ec66ba3781cc584068addc0aec11c6

ran into same problem, though late but solution found.

Just embed each, into each of the destination view controllers, a navigation controller. A navigation bar is bound to be hidden if view controller is not a child of a Navigation Controller .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM