画面上のテーブルビューのアイテムをタップすると、フルスクリーンの写真プレゼンテーションが開くアプリがあります。
フルスクリーンなので、ビューコントローラーを介してメインウィンドウに直接追加します[[[UIApplication sharedApplication] windows] objectAtIndex:0]
。
画像ごとにメニューがあり、画像を表示する UIBarButton をタップすると開きます。UIActionSheet(self.imageActionSheet)
コードで開く[self.imageActionSheet showFromBarButtonItem:sendButtonItem animated:YES];
ios7 では問題なく動作しますが、iPad の ios8 では開きません。
iOS8 では ActionSheet が非推奨になっていることがわかりました。UIAlertController を使用する必要があります。
そのためのテストアラートコントローラーを作成しました
UIAlertController * actionSheet = [UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
}]];
UIPopoverPresentationController *popover = actionSheet.popoverPresentationController;
if (popover)
{
UIView *buttonView = [sendButtonItem valueForKey:@"view"];
popover.sourceView = buttonView;
popover.sourceRect = buttonView.bounds;
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
}
UIWindow * wind = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
[wind.rootViewController presentViewController:actionSheet animated:YES completion:nil];
[[[UIApplication sharedApplication] windows] objectAtIndex:0]
表示されますが、同様のサブビューに含まれるフルスクリーン ビューの下に表示されます。すべてのインターフェイスをオーバーラップする必要があるため、keyWindow に含まれています。
ViewContollerを介してUIAlertControllerのみを表示する方法を見つけましたが、すべてのviewControllerをフルスクリーンビューの下に表示しました。
UIWindow で UIAlertController を表示するにはどうすればよいですか? それともUIBarButtonItemからですか?