Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-04-2010, 01:55 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 11
Default Editin Ttile of Navigatoin Bar in Code

Hey guys, im building an app that implements a navbar with a navigation controller. Right now all it consists of is the intial view that has a button on it that pushes my next view to the screen. However, after I push the view the NavBar doesn't have a title.

I'm assuming I can change the NavBar Title in code right after I push it to the screen I just haven't been able to get it to work.

What I tried already was:

Code:
- (void)viewDidLoad {
	self.navigationController.title = @"Main Menu";
    [super viewDidLoad];
}
which is the predefined function when you creating a new viewController class. This however didn't seem to do anything
pacman6642 is offline   Reply With Quote
Old 01-04-2010, 01:57 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 11
Default

self.navigationItem.title = @"Title Here";

Quote:
Originally Posted by pacman6642 View Post
Hey guys, im building an app that implements a navbar with a navigation controller. Right now all it consists of is the intial view that has a button on it that pushes my next view to the screen. However, after I push the view the NavBar doesn't have a title.

I'm assuming I can change the NavBar Title in code right after I push it to the screen I just haven't been able to get it to work.

What I tried already was:

Code:
- (void)viewDidLoad {
	self.navigationController.title = @"Main Menu";
    [super viewDidLoad];
}
which is the predefined function when you creating a new viewController class. This however didn't seem to do anything
YarGnawh is offline   Reply With Quote
Old 01-04-2010, 02:01 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Washington, DC
Posts: 77
Default

Set the title in the original view before you push the new view onto the stack. Make the new view a property (In the old view) in order to be able to access it.

@synthesize newView;

NewViewController *newestView = [[NewViewController alloc] init..]
self.newView = newestView;
[newestView release];
newView.title = @"New Title";

Then create you delegate and push the new view.
inlvrwetrst is offline   Reply With Quote
Old 01-04-2010, 02:05 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 11
Default

Thanks for the super quick replies guys. I was actually able to get both of those to work. Also, I was able to get

self.title=@"Title";

to work as well in the -viewDidLoad function.

thanks again.
pacman6642 is offline   Reply With Quote
Reply

Bookmarks

Tags
navbar, navigation controller, viewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 239
19 members and 220 guests
ADY, AragornSG, BrianSlick, Dani77, Dattee, dre, glenn_sayers, HemiMG, JasonR, karlam963, nobre84, Oral B, prchn4christ, Raggou, Rudy, spiderguy84, themathminister, viniciusdamone, vvenkatachallam
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,884
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, karlam963
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0