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 06-20-2009, 11:29 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 109
Default Briefly Flash Text

Hi all,
I have a UILabel object, and I want to briefly flash it to another color, then back again to indicate it has been selected.

What is the best way to do this? I successfully can select the label object, but not flash the color back and forth. What is the best way to do this? I tried it with UIView animations, but no dice there. I think doing an NSTimer might work, but I don't know how to pass arguments through @selectors.

How would I go about doing this? Thanks in advance.
brian515 is offline   Reply With Quote
Old 06-21-2009, 08:09 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: currently AZ
Posts: 112
Send a message via MSN to kingbombs
Default

So i think you can do something like this (assuming button is red and you want to change to blue briefly):
Have a method called something like (void)changeColor
Code:
- (void)changeColor {
      button.setColor('Red'); // probably not right syntax for setting color
}
then in your IBAction method for checking if user has pressed the button or where ever you do that check, have something like (not sure if this will deffaintly work):

Code:
button.setColor('Blue');
[self performSelector: @selector(changeColor) withObject:nil afterDelay:2];
this should after 2 seconds call the changeColor method, which will set the button back to red.

hope this helps!
kingbombs is offline   Reply With Quote
Old 06-21-2009, 02:09 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Fort Lauderdale, Florida
Posts: 67
Default

Quote:
Originally Posted by kingbombs View Post
So i think you can do something like this (assuming button is red and you want to change to blue briefly):
Have a method called something like (void)changeColor
Code:
- (void)changeColor {
      button.setColor('Red'); // probably not right syntax for setting color
}
then in your IBAction method for checking if user has pressed the button or where ever you do that check, have something like (not sure if this will deffaintly work):

Code:
button.setColor('Blue');
[self performSelector: @selector(changeColor) withObject:nil afterDelay:2];
this should after 2 seconds call the changeColor method, which will set the button back to red.

hope this helps!
To set the color of a label you would do:
Code:
[label setTextColor:[UIColor redColor]];
or
Code:
label.textColor = [UIColor blueColor];
Ins3rtNam3H3r3 is offline   Reply With Quote
Old 06-21-2009, 03:15 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: currently AZ
Posts: 112
Send a message via MSN to kingbombs
Default

Quote:
Originally Posted by Ins3rtNam3H3r3 View Post
To set the color of a label you would do:
Code:
[label setTextColor:[UIColor redColor]];
or
Code:
label.textColor = [UIColor blueColor];
I was just using .setColor so it was obvious what i was doing
kingbombs is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, color, flash, nstimer, uilabel

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: 252
23 members and 229 guests
ADY, Alsahir, beleg_1998, Dani77, diyora, FAED, fredidf, iDifferent, iph_s, JamesCahall, JasonR, mer10, prchn4christ, Rudy, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, timle8n1, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

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