So how do you correctly setup a popover segue using the storyboard when the button opening it is inside a custom prototype cell within a table view?
I think the most elegant solution is the following:
Create a segue from the button as usual to the appropriate ViewController
Open the segue and set the anchor to the table view (dragging from the circle to the view).
In prepare for segue add the following:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIViewController *vc = (UIViewController *)segue.destinationViewController;
UIPopoverPresentationController *ppc = vc.popoverPresentationController;
UIButton *button = (UIButton *)sender;
ppc.sourceRect = button.frame;
ppc.sourceView = button.superview;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.