I want to present a UIPopoverController using a button on a UICollectionViewCell.
So far, everything is created fine, but the popover is not displayed.
Is there a special way to do this?
The code works if I display it from anything other than a collection view cell.
The following code is in a subclass of 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];
Thanks!
source share