How to correctly present a popover from a UITableViewCell with UIPopoverArrowDirectionRight or UIPopoverArrowDirectionLeft

后端 未结 11 810
失恋的感觉
失恋的感觉 2020-12-02 15:30

I always try to present a popover from a cell inside a tableView this way:

[myPopover presentPopoverFromRect:cell.frame inView:self.tableView permittedArrowD         


        
11条回答
  •  萌比男神i
    2020-12-02 16:00

    This is how i did and works perfectly fine.

    RidersVC *vc = [RidersVC ridersVC];
    vc.modalPresentationStyle = UIModalPresentationPopover;
    vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    UIPopoverPresentationController *popPresenter = [vc popoverPresentationController];
    popPresenter.sourceView = vc.view;
    popPresenter.barButtonItem= [[UIBarButtonItem alloc] initWithCustomView:button];
    popPresenter.backgroundColor = [UIColor colorWithRed:220.0f/255.0f green:227.0f/255.0f blue:237.0f/255.0f alpha:1.0];
    [self.parentVC presentViewController:vc animated:YES completion:NULL];
    

提交回复
热议问题