Reputation: 291
I have a custom navigation and Home view in my app. On the click of button I want to show a View just like a left side view ( width is not equal to screen width) , on the top of navigation. I have tried this:
LeftView.Layer.ZPosition = 1;
It is not working. If I set the Z index of navigation to -1, this hides complete navigation bar.
Upvotes: 2
Views: 1865
Reputation: 277
This is a correct answer:
[self.navigationController.view addSubview:yourSubView];
Though it will not set the correct frame for the view, To set the correct frame for your view on the navigation bar, you have to set it in the viewDidAppear.
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.navigationController.view addSubview:mTitleView];
}
Upvotes: 0
Reputation: 13546
Add your custom navigation bar to the main view manually instead of using navigation controller's standard navigation bar. Then add your leftview
as subview
, in your main view
. It will overlap navigation bar in this hierarchy.
Upvotes: 0
Reputation: 1949
Try to add that view to UIWindow. This will add your view above navigation bar.
[[[[UIApplication sharedApplication] delegate] window] addSubview:yourView];
Upvotes: 2
Reputation: 1099
Try this :
[self.navigationController.view addSubview:yourSubView];
Upvotes: 3