您的位置:首页 > 产品设计 > UI/UE

【代码笔记】iOS-UIAlertView3秒后消失

2017-12-08 09:00 363 查看
一,效果图。



二,代码。

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

UIAlertView* alert = [[UIAlertView alloc]initWithTitle:nil message:@"此信息3秒后消失" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
[alert show];

[self performSelector:@selector(dismissAlert:) withObject:alert afterDelay:3.0];
}
- (void)dismissAlert:(UIAlertView*)alert {
if ( alert.visible ) {
[alert dismissWithClickedButtonIndex:alert.cancelButtonIndex animated:YES];
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: