我有一个自定义 UITableViewCell 类,并且自定义单元格中有一个图像按钮,该按钮链接回单元格类上的方法。触发此方法时,我想从弹出框内的情节提要中启动一个孤立的 UIViewController。我已经尝试了几种技术来做到这一点。如果我将 UIViewController 添加为原型单元上按钮的 segue,则 Interface Builder 将无法编译。有没有人有什么建议?
更新:我得到它与以下工作:
UITableView *tv = (UITableView *) self.superview;
UITableViewController *vc = (UITableViewController *) tv.dataSource;
UIStoryboard *storyboard = vc.storyboard;
UIViewController *actionView = [storyboard
instantiateViewControllerWithIdentifier:@"ActionView"];
popoverController = [[UIPopoverController alloc]
initWithContentViewController:actionView];
popoverController.popoverContentSize = CGSizeMake(320, 416);
[popoverController presentPopoverFromRect:self.actionButton.bounds
inView:self.actionButton
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];