【发布时间】:2013-01-16 18:56:47
【问题描述】:
我希望通过 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];
谢谢!
【问题讨论】:
-
请在您尝试显示弹出框的位置显示代码。您可能使用了错误的矩形。
标签: xcode ios6 uipopovercontroller uicollectionview uicollectionviewcell