views:

28

answers:

1

hi, im working with iphone sdk and i got to show a label when the user clik a button but after some time the label deseapear, can i do that?

A: 

Use NSObject's performSelector: withObject: afterDelay: for that - it will setup NSTimer that performs selector for you. In button click handler:

...
myLabel.hidden = NO;
[self performSelector:@selector(hideView:) withObject:myLabel afterDelay:3];
...

- (void) hideView:(UIView*)inView{
   // You can also add animation here
   view.hidden = YES;
}

Note, that it is not guaranteed that hideView: will get called exactly after 3 sec.

Vladimir
THX it works!!!!!!!
the1nz4ne
Don't forget to put a checkmark on the answer so that Vladimir gets reputation points.
Lyndsey Ferguson