UIScrollView以编程方式自动调整掩码

时间:2013-09-29 22:26:49

标签: objective-c uiscrollview

我正在尝试以编程方式调整UIScrollView的大小,以便在iPhone 5上调整高度,我通过Storyboard实现了这一点,但是想以编程方式进行,

我已经使用以下内容来创建我的UIScrollView,但似乎无法改变尺寸以适应iPhone 5,因为我最初设置较小的iPhone的帧大小?

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(15, 80, 289, 153)];
scroll.autoresizesSubviews = YES;
scroll.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

1 个答案:

答案 0 :(得分:0)

试试这个,

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(15, 80, 289, 153)];
scroll.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin);