Wednesday, November 5, 2014

UIAlertController Example


UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
                                                               message:@"\n\n\n\n\n\n\n\n\n\n\n"             preferredStyle:UIAlertControllerStyleActionSheet];

__weak typeof(self) weakSelf = self;
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    [weakSelf pickActionSheetFinishAction];
}];

[alertController addAction:cancelAction];
[alertController.view addSubview:self.topicPickView];
[self presentViewController:alertController animated:YES completion:nil];


=======================================================================


UIAlertController * searchActionSheet=[UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];

[ searchActionSheet.view setBounds:CGRectMake(7, 180, self.view.frame.size.width, 470)];

//yourView represent the view that contains UIPickerView and toolbar
[searchActionSheet.view addSubview:self.yourView];
[self presentViewController:searchActionSheet animated:YES completion:nil];

No comments: