[英]UIPopover equal screen width
我需要使彈出窗口大小等於設備的屏幕寬度,可以嗎? 我嘗試這樣的代碼:
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
或更大,但是沒有效果,我在左右兩側有一些空格,我該如何解決?
這里是問題的屏幕截圖: http : //uaimage.com/image/c54d471d
從Apple的UIPopoverController文檔中,關於'popoverLayoutMargins'屬性(可在此處找到: UIPopoverController文檔 :
The margins that define the portion of the screen in which
it is permissible to display the popover....
...The edge inset values are measured in points from the edges of the screen,
relative to the current device orientation...
...The default edge insets are 10 points along each edge.
嘗試添加以下內容,看看是否有幫助:
sharePopover.popoverLayoutMargins = UIEdgeInsetsZero;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.