使用UIAlertController报错
2016-01-20 16:29
537 查看
if (IOS8) { UIAlertController * deleAlert = [UIAlertController alertControllerWithTitle:nil message:@"是否删除?" preferredStyle:UIAlertControllerStyleAlert]; [self.view.window.rootViewController presentViewController:deleAlert animated:YES completion:nil]; UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"是" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { }]; UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"否" style:UIAlertActionStyleCancel handler:nil]; [deleAlert addAction:sureAction]; [deleAlert addAction:cancelAction]; }
[self.view.window.rootViewController presentViewController:deleAlert animated:YES completion:nil];如果使用
[self presentViewController:deleAlert animated:YES completion:nil];
会报错:
Presenting view controllers on detached view controllers is discouraged
相关文章推荐
- easyui控件与Activex控件遮挡问题
- UI基础__UICollectionView__瀑布流
- Android官方文档翻译-guide-储存选择
- workqueue 用法实例
- 优化RequireJS项目(合并与压缩)
- image叠加(UIGraphicsBeginImageContext)
- ExtJs技巧 FormPanel.getForm().getValues()的键名问题.
- android.util.AndroidRuntimeException: requestFeature() must be called before adding content 错误解决方法
- UIScrollView控件的代理
- Longest Consecutive Sequence
- select change事件给其它元素赋值,本select的value或tex
- QuartzD虚线及虚线的用处
- JavaGUI-Swing
- Java GUI-AWT
- UIImage剪切
- 蓝牙的应用
- iOS中UISearchBar的placeholder字体颜色以及背景色
- UITextField限制只能输入数字,不能输入其他字符
- hitTest:(CGPoint)point withEvent:(UIEvent *)event
- UIlabel小结