我想在现有的 UILabel
中显示一条简短的警告消息,然后让它在一分钟左右后自动消失,而不必暂停应用程序(如循环或类似操作) .
什么是最好的方法?
最佳答案
使用 NSTimer:
NSTimer* timer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(hideLabel) userInfo:nil repeats:NO];
并且有一个隐藏标签的方法 hideLabel
,使用 [myLabel setHidden:YES];
或类似的方法。
关于objective-c - 显示文本,然后让它在一分钟后消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6284074/