I have a action sheet which i am presenting using UIAlertcontroller in ios8 (xcode 6 beta 5). I am using UIAlertcontroller because UIActionsheet ( which is deprecated in iOS 8 ) was not working properly in ios8, on click of any option in the actionsheet leaded me back to the parent view. Now I am facing one issue in UIAlertcontroller too, double tap outside the action sheet popover is leading me back to the previous parent view. Following is my code snippet:
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 = [sender frame];
dispatch_async(dispatch_get_main_queue(), ^ {
[self presentViewController:actionSheetIos8 animated:YES completion:nil];
});