iOS的警告用法示例 (UIActionSheet不讓用之后,iOS8.3以后)
UIAlertController
UIAlertController *VC = [UIAlertController alertControllerWithTitle:@"是否取消咬摇?" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *loginOutAction = [UIAlertAction actionWithTitle:@"注銷" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
// 點擊注銷按鈕會做一些事
[self.navigationController popViewControllerAnimated:YES];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
// 把按鈕添加進controller
[VC addAction:loginOutAction];
[VC addAction:cancelAction];
// 讓警告顯示出來
[self presentViewController:VC animated:YES completion:nil];
// 顯示在中間的alert(警告)
UIAlertView *ok = [[UIAlertView alloc] initWithTitle:@"是否取消" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"注銷", nil];
[ok show];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者