正如标题所说我希望我的一个物体在一段时间后消失.我在网上搜索了这个主题,我找不到任何答案或教程,所以我从这里问它.
例:
用户打开应用程序.
视图控制器进入屏幕,它上面有一个标签.
该标签在5秒后消失.
我该怎么做 ?
我需要使用动画吗?
我真的更喜欢没有任何动画(如果制作动画很简单那么好)
你可以一步一步地解释它,我会尝试让我的标签先消失然后我会让一个视图对象消失.我知道想要一个视图消失的奇怪我可以使用另一个视图控制器但我不想要它我想把它编码为经过一段时间后消失.
谢谢.
您所要做的就是设置一个计时器.例如,
//In your viewDidLoad method of your view controller
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(hideLabel) userInfo:nil repeats:NO];
//In a method called hideLabel
- (void) hideLabel
{
self.myLabel.hidden = YES; //This assumes that your label is a property of your view controller
}
Run Code Online (Sandbox Code Playgroud)
这里的所有都是它的.
| 归档时间: |
|
| 查看次数: |
4662 次 |
| 最近记录: |