以下是您可以尝试的方法
创建将放置在弹出窗口中的 ViewController,选择它并导航到 Utilities 窗格 > Attributes Inspector > Set Size to Freeform
选择popover segue并导航到Utilities面板> Attributes Inspector > Set Identifier to "yourIdentifier"
第一次尝试
通过选择 ViewController 的 View 并导航到 Utilities 窗格->Size Inspector 来更改 ViewController 的大小 [看看你是否可以获得预期的大小]
第二次尝试- 在您调用 popOverViewController 的视图中尝试此操作
UIPopoverController *popover; // define this in .h as ivar
- (IBAction)buttonPressed:(id)sender
{
UIButton *anchor = (UIButton*)sender;
UIViewController *viewControllerForPopover = [self.storyboard instantiateViewControllerWithIdentifier:@"yourIdentifier"];
popover = [[UIPopoverController alloc]
initWithContentViewController:viewControllerForPopover];
[popover setPopoverContentSize:CGSizeMake(width, height)]; // here see if you can get expected size
[popover presentPopoverFromRect:anchor.frame
inView:anchor.superview
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
第三次尝试
Please look at Trick by krasnyk (accepted answer) for Forcing Popover Size