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
2010-02-19 15:11:53
THX it works!!!!!!!
the1nz4ne
2010-02-19 15:24:02
Don't forget to put a checkmark on the answer so that Vladimir gets reputation points.
Lyndsey Ferguson
2010-02-19 17:20:23