`

iOS8中的UIActionSheet添加UIDatePicker后,UIDatePicker不显示问题

阅读更多

http://www.tuicool.com/articles/y6V3ye

 

解决方法:

 
IOS8以前:

                    UIActionSheet* startsheet = [[UIActionSheet allocinitWithTitle:title

                                                                            delegate:self

                                                                   cancelButtonTitle:@"确定"

                                                              destructiveButtonTitle:nil

                                                                   otherButtonTitles:nil,

                                                 nil];

                    startsheet.tag = 333;

                    [startsheet addSubview:datePicker];

                    [startsheet showInView:self.view];

IOS8以后:

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nilpreferredStyle:UIAlertControllerStyleAlert];

                    

                    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定"style:UIAlertActionStyleCancel handler:^(UIAlertAction *action)

                    {

                       ////todo

                    }];

                    

                    [alertController.view addSubview:datePicker];

                    [alertController addAction:cancelAction];

                    

 

                    [self presentViewController:alertController animated:YES completion:nil];

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics