Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation bar title when using TabBar #44

Open
tomekc opened this issue Nov 1, 2014 · 8 comments
Open

Navigation bar title when using TabBar #44

tomekc opened this issue Nov 1, 2014 · 8 comments

Comments

@tomekc
Copy link

tomekc commented Nov 1, 2014

I have TabBar application and one of the tabs is starting with NavigationController.

The problem is that I am unable to set navigation bar title, in either way:

self.navigationItem.title = "nav item title"

Title remains unchanged. It will work if I move navigation controller to separate storyboard, but then navbar is rendering incorrectly (not extending under status bar).

Any clues?
Thanks!

@BottleMan
Copy link

I have sove just the same problem after adding "needsTopLayoutGuide" = NO to User Defined Runtime Attributes.

@andres-cianio
Copy link

Neither of the previous options worked for me. I ended up fixing this setting the title of the parentViewController:

[self.parentViewController setTitle:NSLocalizedString(@"MyTitle", nil)];

Like stated before, accessing the parent is quite hacky though 👎

@fatuhoku
Copy link

👍 accessing the parent is unforgivable, really. RBStoryboardLink should be totally transparent.

Part of the problem is that RBStoryboardLink is responsible for creating the view controller it points at and effectively takes a 'snapshot' of its properties. However, whenever we change the view controller's settings these changes cannot be propagated upstream.

RBStoryboardLink should work reactively rather than statically. It should use KVO to observe and expose the navigationItem of the underlying view controller rather than maintain one itself. It has no right to.

@mokagio
Copy link

mokagio commented Feb 24, 2015

I just had a similar problem with the rightBarButtonItem, and yeah accessing the parentViewController is not optimal...

@rob-brown any thoughts on the matter?

@stanislaw
Copy link

+1

@MichaelPei
Copy link

@tomekc @stanislaw Actually I think you guys should use the property 'rbsl_storyboardLink', which is defined in the UIViewController+RBStoryboardLink, to access surrogate view controller and change the property you wanted, the code should look like:

self.rbsl_storyboardLink.navigationItem.title = "nav item title";

Because when you change navigation item or others, actually you are changing the navigation item of your container navigation controller's navigation item and now the surrogate view controller (a RBStoryboardLink class) is contained in the navigation controller not your view controller, so you should access property like the code above.
Hope this will help.

@MarcosEich
Copy link

Having the same problem here. It would be nice to have a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants