// 让数组中所有元素 执行 相同的方法 removeFromSuperview
[_answerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
// 是否允许用户进行交互
// 一旦 父 view 被禁用, 那么他的子view 也将不会接收用户交互
_optionView.userInteractionEnabled = NO;
// 把 iconButton (它是 self.view 的子view) 放到 view的最前面
[self.view bringSubviewToFront:_iconButton];
UIAlertController
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"come on!" message:@"you win!" preferredStyle:UIAlertControllerStyleAlert];
//样式:
UIAlertControllerStyleAlert : 提示框
UIAlertControllerStyleActionSheet : 从下面弹出的提示框
//想要显示alertController 必须通过下面的方法:
[self presentViewController:alertController animated:YES completion:nil];
//为alertController 添加 按钮
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
// 当点击这个action 的时候, 就会回调这个block(代码块)
}];
[alertController addAction:cancelAction];
// 注意
UIAlertActionStyleCancel : 如果设置action style 的时候 出现两个 cancel , 就会导致崩溃
[_answerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
// 是否允许用户进行交互
// 一旦 父 view 被禁用, 那么他的子view 也将不会接收用户交互
_optionView.userInteractionEnabled = NO;
// 把 iconButton (它是 self.view 的子view) 放到 view的最前面
[self.view bringSubviewToFront:_iconButton];
UIAlertController
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"come on!" message:@"you win!" preferredStyle:UIAlertControllerStyleAlert];
//样式:
UIAlertControllerStyleAlert : 提示框
UIAlertControllerStyleActionSheet : 从下面弹出的提示框
//想要显示alertController 必须通过下面的方法:
[self presentViewController:alertController animated:YES completion:nil];
//为alertController 添加 按钮
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
// 当点击这个action 的时候, 就会回调这个block(代码块)
}];
[alertController addAction:cancelAction];
// 注意