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

解决方法:

 
IOS8以前:

                    UIActionSheet* startsheet = [[UIActionSheet alloc] initWithTitle: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];

posted on 2015-10-13 19:03  🌞Bob  阅读(244)  评论(0编辑  收藏  举报

导航