我正在尝试展示一个弹出框控制器,但由于某种原因,我无法正确设置弹出框的宽度/高度。这是我正在使用的代码:
这是我的代码:
UIStoryboard* myStoryboard = self.storyboard;
ScenarioPopOver* popOver = (ScenarioPopOver*)[myStoryboard instantiateViewControllerWithIdentifier:@"scenarioPopover"];
popOver.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:popOver animated:YES completion:nil];
// configure the Popover presentation controller
UIPopoverPresentationController *popController = [popOver popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionUp;
popController.delegate = self;
// in case we don't have a bar button as reference
popController.sourceView = self.view;
popController.sourceRect = CGRectMake(self.view.center.x - 25.0, 10.0, 50.0, 50.0);
但是popover一直像这样出来: