开发者

NSTimer on a label

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜