Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 22, 2009, 04:28 AM   #1
thomasjt
macrumors newbie
 
Join Date: Apr 2009
Setting navbar title with variable

Hi,

I have a view which is created with details which depend on which button a user clicks. So, say the user clicks a button named 'Tom', I would like the navbar title to be Details of Tom...

I've tried this:

Code:
detailView.title = @"Details of %@", whichButton.titleLabel.text;
Where whichButton is the button that the user clicked on. Unfortunately, all this shows me is 'Details of %@' in the navbar title.

Any ideas?
thomasjt is offline   0 Reply With Quote
Old Jun 22, 2009, 04:56 AM   #2
jnic
macrumors 6502a
 
Join Date: Oct 2008
Location: Cambridge
http://devworld.apple.com/iphone/lib...ingWithFormat:
jnic is offline   0 Reply With Quote
Old Jun 22, 2009, 05:33 AM   #3
thomasjt
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
Wow, that was exactly what I was looking for and was very helpful. Sadly though I suck and (new scenario now) in the situation I am trying to use it this doesn't work:
Code:
UIImage *myImage = [[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@", name]]];
Any suggestions? Sorry, I'm very new to Objective-C and the syntax is still really confusing me.

Cheers,

Tom
thomasjt is offline   0 Reply With Quote
Old Jun 22, 2009, 05:39 AM   #4
jnic
macrumors 6502a
 
Join Date: Oct 2008
Location: Cambridge
imageWithContentsOfFile needs a path:

Code:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"yourImage" ofType:@"png"]];
You might prefer imageNamed if you want to just hand it a string.
jnic is offline   0 Reply With Quote
Old Jun 22, 2009, 06:14 AM   #5
thomasjt
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
Sweet, that was a great help. Thanks very much
thomasjt is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
applescript studio, set button title issue.... butteryak Mac Programming 0 May 14, 2011 02:52 PM
How can I set popover title bar color to the same as default navigationBar? mikezang iPhone/iPad Programming 1 Jan 3, 2011 05:40 AM
Set Navigation.Title before http url sent benhowdle89 iPhone/iPad Programming 5 Oct 24, 2010 04:40 AM
Navbar title? UberMonjie iPhone/iPad Programming 5 Feb 18, 2009 10:21 AM
setting UINavigationItem title programatically Xentarios iPhone/iPad Programming 0 Jul 29, 2008 10:01 PM


All times are GMT -5. The time now is 01:18 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC