Reputation: 124
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
It's a screen shot when up corner it's slightly display.
I used this code for hide the navigation bar in view.but when view will start then it's give me effect like navigation bar are present.
But, I want to remove this effect or remove the navigation bar only this view.
Upvotes: 5
Views: 16681
Reputation: 1893
The thing to remember is that views will be drawn in a particular order, and they are uniquely affected by your navigation bar. Based on when you hide your navigation bar your other views may change size or position.
Try putting this in viewDidLoad:
self.navigationController.navigationBarHidden = YES;
And then, in viewWillAppear, add your view placement and configuration code.
This strategy will remove the navigation bar FIRST, then properly place and size your assets accordingly.
Happy coding!
Upvotes: 4
Reputation: 6454
Use this may be help full for you
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBarHidden = YES;
Upvotes: 1
Reputation: 2139
In Case if you are using storyboard Make sure green arrow highlighted fields are unchecked
Option 2
Put below lines of code in didFinishLaunchingWithOptions
[self.navigationController setNavigationBarHidden:YES]; –
Upvotes: 15
Reputation: 7226
Please use this [self.navigationController setNavigationBarHidden:YES];
or self.navigationController.navigationBarHidden = YES;
to hide the navigation bar in the view you want it hidden.
Upvotes: 2