UIAlertController 用法简介
2016-04-10 23:50
453 查看
让数组中所有元素
执行
相同的方法
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 ,
就会导致崩溃
相关文章推荐
- Android Studio Error : Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled
- String、SpannableString与SpannableStringBuilder却别和使用
- 两个imageView实现图片轮播
- UI控件--Fragment
- leetcode 232. Implement Queue using Stacks-栈模拟队列
- IOS Animation-CAShapeLayer、UIBezierPath与Animation的结合
- [LeetCode]128. Longest Consecutive Sequence
- UI控件--Gallery
- BlockingQueue接口
- UI控件--ListView补充:包含多个子项布局的列表
- lvalue rvalue左值右值的区别
- Arduino IDE 编译生成过程
- 键盘录入 写入文件 quit时 结束
- LigerUI真假分页以及过滤查询功能
- [Java][Maven]Maven部署Web项目报错webxml attribute is required
- arduino 串口实时绘图(以mpu9250为例)
- distinct subsequences
- 自定义UISlider
- 网页中内容的滚动 :marquee标签属性详解
- iOS开发68-iOS 如何让UIScrollView在手指离开后立即停止滑动