首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIPopover等屏宽度

UIPopover等屏宽度
EN

Stack Overflow用户
提问于 2014-10-25 12:21:31
回答 1查看 258关注 0票数 0

我需要使弹出尺寸等设备屏幕宽度,这是可能的吗?我尝试这样的代码:

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-25 13:00:23

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

代码语言:javascript
复制
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.  

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

代码语言:javascript
复制
sharePopover.popoverLayoutMargins = UIEdgeInsetsZero;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26562308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档