iPhone 응용 프로그램의 Alert Controller (경보 컨트롤러)와 같이 여러 항목이있는 버튼으로 성공적으로 구성된 탐색 모음의 제목에서 팝업을 표시하려고합니다. 다음 코드는 제목을 두드렸을 때 호출되지만 액션 시트가 팝 오버 대신 하단에 표시됩니다. 무엇이 잘못되었는지 찾도록 도와 줄 수 있습니까? 감사. 이 아이폰에 더 popoverPresentationController이 없습니다로iPhone OS 용 Popover에서 UIAlertController를 표시하는 방법 8
UIAlertController * alertController = [UIAlertController alertControllerWithTitle: nil
message: nil
preferredStyle: UIAlertControllerStyleActionSheet];
[alertController addAction: [UIAlertAction actionWithTitle:@"Close" style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
// dismiss viewcontroller
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
// Handle Cancel
// do nothing
}]];
alertController.modalPresentationStyle = UIModalPresentationPopover;
alertController.preferredContentSize = CGSizeMake(250.0, 180.0);
UIPopoverPresentationController *popoverPresentation = alertController.popoverPresentationController;
popoverPresentation.sourceRect = self.parentViewController.navigationItem.titleView.frame;
popoverPresentation.sourceView = self.view;
popoverPresentation.permittedArrowDirections = UIPopoverArrowDirectionUp;
popoverPresentation.delegate = self;
[self presentViewController: alertController animated: YES completion: nil];