Self.alertcontroller=[uialertcontroller alertcontrollerwithtitle:@ "Please select \n\n\n\n\n\n\n\n\n\n\n\n\n\n" Message:nil preferredstyle:uialertcontrollerstyleactionsheet];//define a alertaction, style select destructive OK button, handler is the processing method uialertaction *destaction=[uialertaction actionwithtitle:@ "OK" & nbsp , &NB Sp style:uialertactionstyledestructive handler:^ (uialertaction *action) { & nbsp , &NB Sp [self selectdatafrompick];//Select data , &NB Sp &NBSP }]; [Self.alertcontroller addaction:destaction ]; View Controller Add method [Self.alertController.view addsubview:self.picker];//Add child view
(2) Alert with input box
If you need to add an input box above Alertview, as follows:
[Alertcontroller addtextfieldwithconfigurationhandler:^ (Uitextfield *textfield) { //You can customize the TextField here, such as changing the background color textfield.backgroundcolor = [Uicolor orangecolor]; }] ;
iOS8 about Uialertcontroller instead of Uiactionsheet