开发者

Back button don't appear in navigationController

I have a UIViewController, with a navigationController, and I hide the back button. This viewController push a other UIViewController, and in the viewDidLoad of this new viewController, I do:

self.navigationItem.hidesBackButton = FALSE;

But the backbutton doesn't happear. Why? And this don't work when I pass to the new Xcode version for iOS 4.2, because in the latest version, it all works w开发者_如何转开发ell.


Is there a title for the previous navigationController (on the navigation bar)? Sometimes, if there is no title, the first back button is hidden automatically.


If you're using Interface Builder, check the Navigation Item object inside the View Controller that is attached to the Navigation Controller.. For clarity, in IB:

Navigation Controller || Something View Controller || Navigation Item

In Inspector on the Attributes tab, there should be a Text Field named "Back Button". Make sure this has something in it such as "Back".

After it's listed for the first ViewController, it will propagate through the stack.


Well, I had the same problem running iOS 4.2. The back button would refuse to appear. Upon autoroating to landscape, it then appears. My solution was to do the following - This fixed the problem...or should we say its a workaround ;)

- (void)viewDidLoad 
{
    [super viewDidLoad];
    checkHolder.image = anImage;
    self.navigationItem.hidesBackButton = YES;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.navigationItem.hidesBackButton = NO;
}


I tend to agree with Syoleen , one should have a title text set to the navigationController, You can set the title to @" " (thats a space there in-between) if you don't want it to be shown but still have it active.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜