我有一个动作表,我在ios8(xcode 6 beta 5)中使用UIAlertcontroller进行演示.我正在使用UIAlertcontroller,因为UIActionsheet(在iOS 8中已弃用)在ios8中无法正常工作,单击操作表中的任何选项都会导致我回到父视图.现在我也面临着UIAlertcontroller中的一个问题,在操作表弹出窗口外面双击会让我回到上一个父视图.以下是我的代码段:
UIAlertController *actionSheetIos8;
actionSheetIos8 = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
NSArray *buttonsArray = [self returnMoreArray];
int startY = 10;
for (int i = 0; i < [buttonsArray count]; i++) {
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:[buttonsArray objectAtIndex:i] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSString *newStr = [buttonsArray objectAtIndex:i];
newStr = [[newStr lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@"_"];
}];
[actionSheetIos8 addAction:defaultAction];
}
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
}];
[actionSheetIos8 setModalPresentationStyle:UIModalPresentationPopover];
UIPopoverPresentationController *popPresenter = [actionSheetIos8
popoverPresentationController];
popPresenter.sourceView = sender;
popPresenter.sourceRect …Run Code Online (Sandbox Code Playgroud)