У меня есть лист действий, который я представляю с помощью UIAlertcontroller в ios8 (xcode 6 beta 5). Я использую UIAlertcontroller, потому что UIActionsheet (который устарел в iOS 8) не работал должным образом в ios8, при нажатии любой опции на листе действий вернул меня к родительскому виду. Теперь я столкнулся с одной проблемой в UIAlertcontroller, двойным нажатием вне листа действия popover возвращает меня к предыдущему родительскому представлению. Ниже мой фрагмент кода:Двойной кран из окна действия снаружи, представленный с использованием UIAlertController, приводит к возврату к родительскому виду в ios8 xcode 6 beta 5
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];
});
Я просто испытал те же проблемы с использованием контроллера представления popover; двойное нажатие за пределами popover создает этот неожиданный (и нежелательный) побочный эффект. Ищете решения сейчас ... – idStar