iOS8 苹果推荐使用UIAlertVController替代以前的UIAlertView和UIActionsheet。
UIAlertController不仅全面接管UIAlertView和UIActionsheet,而且用block替代了代理。
注意,UIAlertController是要在viewDidAppear之后加载才会显示!而UIAlertView在viewDidLoad里就可以显示。
很好用的UIAlertController——
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSString *message = @"1、增加白菜党等特色加白菜党等特色加白菜党等特色加白菜党等特色加白菜党等特色标签筛选\n2、增加频道热度排行\n3、增加夜间模式\n4、Material design风格优化\n5、滑动返回优化\n6、其他bug修复";
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
NSLog(@"%@",action.title);
}];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSLog(@"%@",action.title);
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}