In my app I've got a UITableView and one cell of it has a UIButton in it. This button has an action:
    - (IBAction)showPopover:(UIButton *)sender    
{
    ChoseOptionsViewController *contentController = [[ChoseOptionsViewController alloc] init];
    contentController.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *copvc = contentController.popoverPresentationController;
    copvc.permittedArrowDirections = UIPopoverArrowDirectionAny;
    copvc.sourceView = self.view;
    copvc.sourceRect = sender.bounds;
    contentController.preferredContentSize = CGSizeMake(200, 200);
    [self presentViewController:contentController animated:YES completion:nil];
}
The problem is that sender.bounds returns nothing so the popover is shown in the upper left corner of self.view, not by the side of the button.
Thanks in advance.
Try changing your sourceView to sender:
copvc.sourceView = sender;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With