我必須使用UIAlertController顯示帶有選取器,取消和完成按鈕的視圖。這是我寫的代碼:UIAlertController禁用屏幕上的所有觸摸事件
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:alertAction];
[alertController.view addSubview:pickerView];
[alertController.view addSubview:cancelBtn];
[alertController.view addSubview:doneBtn];
[alertController.view setBounds:CGRectMake(0, 180, self.view.frame.size.width, 400)];
,這是我如何調用本視圖控制器方法:
UIPopoverPresentationController *popover = alertController.popoverPresentationController;
if (popover)
{
popover.sourceRect = CGRectMake(0, 0, 320, 550);
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
}
[self presentViewController:alertController animated:YES completion:nil];
報警控制器屏幕後出現在屏幕上,我無法利用上取消並完成按鈕以及屏幕上的任何位置。請幫我解決這個問題。
沒有設置界定取消和done按鈕出現在頁面的底部:
每當我設置範圍至alertcontroller,我能看到正確的觀點,但不能選擇什麼:
你知道嗎? – Markymark 2016-08-31 20:07:40