开发者

black bar as the view fades when I am using navigation controller

I'm writing my first iPhone app and I am trying to figure out how to have a MasterView and DetailsView like in the example. However, instead of using a TableView, I want to use a button on the MasterView to go to the SignUpView. I want the MasterView to NOT have a navigation bar but the SignUpView needs to have one.

I have tried putting a NavigationController into the MasterV开发者_Go百科iew using the interface builder. This doesn't seem to do anything at all ... I.e. I make the following call:

[self.navigationController pushViewController:signUpViewController animated:YES];

And nothing happens. The SignUpView is never shown.

So then I declared a NavigationController in the AppDelegate. The above call in the same function that it was in before (button handler, button is in MasterView) works now! It takes me to the SignUpViewController.

however, the issue is, when I press back on the navigation bar in the sign up view, the navigation bar shows up again in the MasterView. I tried to set

self.navigationController.navigationBarHidden = YES;

in viewDidLoad and viewDidAppear, but that causes a black bar to appear in the transition from SignUpView to MasterView.

I tried to not set it in one of the two, and that causes the animation to go smoothly, but the navigation bar shows up in the MasterView.

I feel like this should be pretty simple to do ... but I'm at my wits end trying to figure this out. Some help would be really appreciated!

Thanks.


Probably not the answer to your question, but just a small suggestion. In the many apps that I have come across, a sign-up/sign-in view is generally displayed as a modal view (on top of your master view) with a 'cross' in the top-right corner to dismiss it. Probably it results in a better user experience.

Also, did you try self.navigationController.navigationBarHidden = YES; in the MasterView's viewWillAppear ?

HTH,

Akshay


I had this problem too, until I discovered setNavigationBarHidden. You will probably want to use these in viewWillAppear/viewWillDisappear or viewDidAppear/viewDidDisappear. You don't want to call this in viewDidLoad because that is only called once when the view is initialized, not every time it appears.

To hide:

[self.navigationController setNavigationBarHidden:YES animated:YES];

To show:

[self.navigationController setNavigationBarHidden:NO animated:YES];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜