im working with iphone sdk and i 开发者_JS百科got to show a label when the user clik a button but after some time the label deseapear, can i do that?
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.
精彩评论