私は、UICollectionViewCellのボタンからUIPopoverControllerを提示することを検討しています。UICollectionViewCellからUIPopoverControllerを提示する
これまではすべてが正常に作成されましたが、ポップオーバーは表示されません。
これを行う特別な方法はありますか?
コレクションビューセル以外のものから表示すると、コードが機能します。
次のコードは、UICollectionViewCellサブクラスにあります。
if (_infoPopover == nil) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
GameInfoViewController *gameInfoVC = (GameInfoViewController *)[storyboard instantiateViewControllerWithIdentifier:@"GameInfoViewController_ID"];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:gameInfoVC];
_infoPopover = popover;
[gameInfoVC setGameNameString:_gameNameLabel.attributedText];
}
[_infoPopover presentPopoverFromRect:_infoButton.frame inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
ありがとうございます!
ポップオーバーを表示しようとするコードを表示してください。あなたはおそらく間違った矩形を使用しています。 – jrturton
更新済み、上記を参照してください。 –