欢迎访问移动开发之家(rcyd.net),关注移动开发教程。移动开发之家  移动开发问答|  每日更新
页面位置 : > > > 内容正文

iOS:UIAlertView3秒后消失,iosuialertview3

来源: 开发者 投稿于  被查看 18542 次 评论:275

iOS:UIAlertView3秒后消失,iosuialertview3


一,效果图。

\

二,代码。

- (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];

}

}

用户评论