preferredContentSize不起作用而不是contentSizeForViewInPopover

时间:2014-03-06 10:34:41

标签: iphone xcode ios7 xcode5

我正在开展项目,我想让我的应用与IOS7兼容。

self.contentSizeForViewInPopover = CGSizeMake(90, 1 * 65 - 1);

此方法已从ios7

弃用

新方法是self.preferredContentSize= CGSizeMake(90,1*65-1);

但我没有得到正确的用户界面enter image description here

但是当我使用ios7兼容方法进行更改时,我的观点就像这样

使用ios7方法我得到了这个  enter image description here

1 个答案:

答案 0 :(得分:7)

这在Apple文档中给出:

  

此属性允许方向操作弹出窗口的内容大小。直接更改属性等同于animated = YES。内容大小限制为最小宽度320,最大宽度600。

@property (nonatomic) CGSize popoverContentSize;

- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated;

我已经实现了像这样处理popover的内容大小。它的工作:

self.popController.popoverContentSize = CGSizeMake(430, 460);