
iOS9中改变了UIAlertView的使用方式, 并且与UIActionSheet融合进了一个类里面,统一进行管理.
- (void)loginOut { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"确定注销吗?" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { [self.navigationController popViewControllerAnimated:YES]; NSLog(@"已注销"); }]; UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { NSLog(@"取消注销"); }]; [alertController addAction:action]; [alertController addAction:cancel]; [self presentViewController:alertController animated:YES completion:nil]; }
|
近期评论