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

View Single Post
Old 05-22-2009, 12:42 PM   #9 (permalink)
emansfield
New Member
 
Join Date: May 2009
Location: Fredericton, New Brunswick, Canada
Posts: 21
Default Success - finally!

Update!

I finally figured out how to set the title in a modal view with navigation bar. It seems pretty kludgy and arcane to me, but it works:

1. Define an IBOutlet for a UINavigationItem in your view controller code.
2. In IB connect the title item from the navigation bar (not the bar itself, but the embedded title) to the outlet defined in #1.
3. In the viewDidAppear method set the title property of the UINavigationItem.

Note! It has to be done in the viewDidAppear method, not the viewWillAppear method, as the navigation bar is obviously not initialized until after the viewWillAppear method has been called. If you put it in the viewWillAppear method then it will show on the second and subsequent appearance of the view, but not on the first.

A similar procedure is necessary to programmatically set the UIBarButtonItem objects in the navigation bar, except that the outlet needs to reference the entire navigation bar, not the bar's title.

This seems like a bug in the UI SDK code. It does not work by just setting the title of the navigationItem property of the view, even if you set it in the viewDidAppear method.
emansfield is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,798
Threads: 89,205
Posts: 380,608
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Frasier2027
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:57 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.