Ios 等屏幕宽度上的UIPOP

Ios 等屏幕宽度上的UIPOP,ios,objective-c,ipad,uipopovercontroller,Ios,Objective C,Ipad,Uipopovercontroller,我需要使popover大小与设备屏幕宽度相等,可以吗?我尝试这样的代码: ShareViewController *shareVC = [[ShareViewController alloc] init]; sharePopover = [[UIPopoverController alloc] initWithContentViewController:shareVC]; sharePopover.popoverContentSize = shareVC.view.frame.size; //

我需要使popover大小与设备屏幕宽度相等,可以吗?我尝试这样的代码:

ShareViewController *shareVC = [[ShareViewController alloc] init];
sharePopover = [[UIPopoverController alloc] initWithContentViewController:shareVC];
sharePopover.popoverContentSize = shareVC.view.frame.size; // width there is 1024 i'm sure
sharePopover presentPopoverFromRect:CGRectMake(sender.frame.origin.x, sender.frame.origin.y + 10, sender.frame.size.width, sender.frame.size.height) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
我还尝试在
popoverContentSize
中按数字设置宽度,如
1024
,或更大,但没有效果,我在左右两侧都有一些空格,如何修复它

这里是问题的截图:

来自苹果的UIPopoverController文档,关于“popoverLayoutMargins”属性(可在此处找到::

尝试添加以下内容,看看是否有帮助:

sharePopover.popoverLayoutMargins = UIEdgeInsetsZero;

如果你想得到这种完全的控制,可以考虑使用一个PopFor以外的东西。为什么没有一个呈现的视图控制器?在IOS 7和8中,很容易使呈现的视图出现在主视图前面,就像一个POPORE。你所拥有的看起来甚至不像一个PopFo,所以现在还不清楚你为什么想要使用一个。在我的情况下,我可以使用popover,因为我不需要编程动画来显示和隐藏他,但这不是主要问题,总之,我决定使用popover,如果没有解决方案,我将使用UIView或UIViewController,谢谢。这对IOS7非常有效,但对IOS8不起作用,但总比没有好,谢谢。@matt documentation doe不要说它在iOS 8中被弃用了。它是一个bug吗?@AMI289我当然认为它是一个bug。
sharePopover.popoverLayoutMargins = UIEdgeInsetsZero;