码迷,mamicode.com
首页 > 移动开发 > 详细

ios8 关于UIAlertController 代替UIActionsheet

时间:2014-10-26 11:36:52      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   io   os   sp   数据   div   

self.alertController=[UIAlertController alertControllerWithTitle:@"请选择\n\n\n\n\n\n\n\n\n\n\n\n\n\n" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
//定义一个AlertAction ,style 选择Destructive 确定按钮,handler中是处理方法
        UIAlertAction *destAction=[UIAlertAction actionWithTitle:@"确定"
                                                           style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                                                               [self selectDataFromPick];//选择数据
                                                           }];
        [self.alertController addAction:destAction];  //视图控制器添加方法

        [self.alertController.view addSubview:self.picker];//添加子视图

(2)带有输入框的alert

如果需要在 alertview上面添加输入框等,如下:
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        // 可以在这里对textfield进行定制,例如改变背景色
        textField.backgroundColor = [UIColor orangeColor];
    }];

 

ios8 关于UIAlertController 代替UIActionsheet

标签:des   style   blog   color   io   os   sp   数据   div   

原文地址:http://www.cnblogs.com/niit-soft-518/p/4051698.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!