xcode preferredContentSize 不工作,而不是 contentSizeForViewInPopover

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22221837/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:43:19  来源:igfitidea点击:

preferredContentSize not working instead of contentSizeForViewInPopover

iphonexcodeios7xcode5

提问by Anil Prasad

I am working on project where i want to make my app compatible with IOS7.

我正在从事我想让我的应用程序与 IOS7 兼容的项目。

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

this method is deprecated from ios7

此方法已从 ios7 弃用

new method is self.preferredContentSize= CGSizeMake(90,1*65-1);

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

but i am not getting proper UIenter image description here

但我没有得到正确的用户界面在此处输入图片说明

but when i am changing with ios7 compatiable method my view is like this

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

with ios7 method i am getting this enter image description here

使用 ios7 方法我得到了这个 在此处输入图片说明

回答by Sharma

This is given in apple documentation:

这是在苹果文档中给出的:

This property allows direction manipulation of the content size of the popover. Changing the property directly is equivalent to animated=YES. The content size is limited to a minimum width of 320 and a maximum width of 600.

此属性允许对弹出窗口的内容大小进行方向操作。直接改变属性相当于animated=YES。内容大小限制为最小宽度 320 和最大宽度 600。

@property (nonatomic) CGSize popoverContentSize;

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

I have implemented to handle the content size of popover like this & its working:

我已经实现处理这样的弹出窗口的内容大小及其工作:

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