是否有其他方式显示对象/按钮/其他内容,例如 3 秒而不是 NSTimer?
我可以使用动画来做到这一点吗?
您可以使用-performSelector:withObject:afterDelay:
,尽管它内部使用了一个计时器。
[theLabel performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:3];
你不能使用-setHidden:
用这种方法,因为1
不是一个对象,但你可以使用NSInvocation
.
NSInvocation* invoc = [NSInvocation invocationWithMethodSignature:[theLabel methodSignatureForSelector:@selector(setHidden:)]];
[invoc setTarget:theLabel];
[invoc setSelector:@selector(setHidden:)];
BOOL yes = YES;
[invoc setArgument:&yes atIndex:2];
[invoc performSelector:@selector(invoke) withObject:nil afterDelay:3];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)