Popover Controller 无法正确显示视图

Popover Controller doesn't show view correctly

我有一个 ViewController,当按下右 barButton 时,会显示一个弹出视图。弹出视图是一个 table 视图控制器,

问题是当弹出窗口显示时,它只显示一个视图(不是 table 视图)。

但是当弹出窗口被关闭时,您可以看到它在消失之前非常快速地翻转到 table 视图。

为什么会这样?

更新:根据@sticker:

在末尾添加 popController.sourceView = sender;
- (IBAction)pressedButton:(id)sender {
    NSLog(@"Pressed Button");

    // grab the view controller we want to show
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"Pop"];

    // present the controller
    // on iPad, this will be a Popover
    // on iPhone, this will be an action sheet
    controller.modalPresentationStyle = UIModalPresentationPopover;
    [self presentViewController:controller animated:YES completion:nil];

    // configure the Popover presentation controller
    UIPopoverPresentationController *popController = [controller popoverPresentationController];
    popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
    popController.barButtonItem = self.barbutton;
    popController.delegate = self;

    // Added per @sticker
    popController.sourceView = sender;
}

还确保 PopTableViewController 确实有 <UITableViewDelegate, UITableViewDataSource>

在弹出窗口被关闭之前,我仍然没有table视图显示:

(下面是弹出窗口消失并动画化后会发生的情况)

我刚试了这个,效果很好 希望对你有帮助

 self.tbVC.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *popOverVC =   [self.tbVC popoverPresentationController];
    popOverVC.barButtonItem = sender;
    popOverVC.permittedArrowDirections = UIPopoverArrowDirectionAny;


    [self presentViewController:_tbVC animated:YES completion:nil];