NavigationBar Puzzle
I have 2 Views. The first view is superview having a navigationBar on the top. On my first View there is one button having this method:
-(IBAction)openView:(id)sender{
[self.navigationController setNavigationBarHidden:YES animated:NO];
view1 = [[ImageView alloc] init];
view1.largeImageDataTwo = self.aNewsInfo.largeImageData;
view1.titleTwo = self.aNewsInfo.title;
[self.view addSubview:view1.view];}
This action opens the view1 without having navigation-bar on the top. (as i want)
and开发者_高级运维 on this particular page (View1) i'm having another button which using this method
-(IBAction)back:(id)sender{
[d1.navigationController setNavigationBarHidden:NO animated:NO];
[self.view removeFromSuperview];}
this method returns me to my 1st view(d1) but this time when I returned my 1st View is without the navigationBar but I want navigation bar back on this 1st View when I returned from the 2nd View.
How can I do this? How can I get navigationBar back on 1st View when returned from the Second View?
Thanks in advance
In your first view, in your viewWillAppear:
method, try calling [self.navigationController setNavigationBarHidden:NO animated:NO]
.
In your second view, after you call removeFromSuperview
, you might have to call [d1 viewWillAppear:YES]
. I am not sure if that is considered "best practice", but you might need to force it like this because removeFromSuperview
may not call the super view's viewWillAppear:
method automatically (like some other methods that change the view hierarchy.)
精彩评论