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 07-08-2008, 04:18 AM   #1 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 5
Default IB - UIButton title with a code and shadow

I have a UIButton coming from the Interface Builder and I want to set the title without using IB, this would make the multi language support easier. I guess there is something like this, but this doesn't work :roll: :

Code:
- (void)awakeFromNib {
	[TheBtn setTitle:@"Title"];
}
In the Interface Builder I said that the button should have a shadow but the shadow isn't shown. I would like to have one!
Please help me!
Marius
marius1625 is offline   Reply With Quote
Old 07-08-2008, 11:51 AM   #2 (permalink)
New Member
 
Join Date: May 2008
Posts: 79
Default Re: IB - UIButton title with a code and shadow

I just type this up.. seems to work:

Code:
-(void)awakeFromNib
{
	NSLog(@"awake");
	srandom(time(NULL));
	[theButton setTitle:@"Roll Dice" forState:UIControlStateNormal];
	[theButton setTitle:@"Rolling!" forState:UIControlStateHighlighted];
}
but this doesn't seem to do anything for me:

Code:
	[theButton setTitleShadowColor:[UIColor redColor] forState:UIControlStateNormal];
	[theButton setTitleShadowColor:[UIColor blueColor] forState:UIControlStateHighlighted];

Scott
ps: seems this formatter doesn't like long lines... sorry.
scottyelich is offline   Reply With Quote
Old 07-08-2008, 03:19 PM   #3 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 5
Default Re: IB - UIButton title with a code and shadow

OK, thanks. But a shadow would be cool . Perhaps someone knows how to do this.
marius
marius1625 is offline   Reply With Quote
Old 07-15-2008, 12:07 PM   #4 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 38
Default

I have the same problem, I would like to have a Shadow on an UIButton
toom is offline   Reply With Quote
Old 08-07-2008, 11:03 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 10
Default

I trying to figure out how you guys did this ...

Did you set the 'Name' of the button to 'theButton'?
leed76 is offline   Reply With Quote
Old 01-19-2009, 02:10 PM   #6 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 91
Default

Quote:
Originally Posted by scottyelich View Post
I just type this up.. seems to work:

Code:
-(void)awakeFromNib
{
	NSLog(@"awake");
	srandom(time(NULL));
	[theButton setTitle:@"Roll Dice" forState:UIControlStateNormal];
	[theButton setTitle:@"Rolling!" forState:UIControlStateHighlighted];
}
but this doesn't seem to do anything for me:

Code:
	[theButton setTitleShadowColor:[UIColor redColor] forState:UIControlStateNormal];
	[theButton setTitleShadowColor:[UIColor blueColor] forState:UIControlStateHighlighted];

Scott
ps: seems this formatter doesn't like long lines... sorry.



I just figured this out.... you need to set the shadow offset....

Code:
CGSize myOffset;
		myOffset.width = 2.0f;
		myOffset.height = 2.0f;
		customButton.titleShadowOffset = myOffset;
pcmofo is offline   Reply With Quote
Reply

Bookmarks

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting title for left button of navigation bar... satvik_85 iPhone SDK Development 18 06-18-2011 03:10 AM
Subclassing UIButton gloubibou iPhone SDK Development 3 09-07-2008 10:01 AM
Changing UIBackBarButtonItem title? myersn024 iPhone SDK Development 7 06-19-2008 04:03 PM
UIButton with an image ddavtian iPhone SDK Development 1 04-30-2008 03:53 PM
UIButton toggle brianr iPhone SDK Development 2 04-29-2008 10:43 AM


» Advertisements
» Online Users: 312
19 members and 293 guests
@sandris, ADY, dacapo, Dani77, djohnson, dre, HDshot, HemiMG, JasonR, MarkC, mer10, nibeck, prchn4christ, ryandb2, spiderguy84, timle8n1, tomtom100, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

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