【发布时间】:2011-03-14 11:17:43
【问题描述】:
我通过 XIB 创建了一个 UIScrollVIew(name-helpView),大小为 (768,1800)。 现在我通过以下代码将其添加到另一个视图中。
-(IBAction)showHelpView:(UIButton *)sender{
if(helpViewIsShowing==NO){
//set the content size more than the view size to make the view scroll
helpView.contentSize = CGSizeMake(helpView.frame.size.width, 2200);
[self.view addSubview:helpView];
helpButton.selected=YES;
helpView.backgroundColor=[UIColor whiteColor];
helpView.frame=CGRectMake(0, 41, helpView.frame.size.width, helpView.frame.size.height);
helpViewIsShowing=YES;
}
else{
[helpView removeFromSuperview];
helpButton.selected=NO;
helpViewIsShowing=NO;
}
}
当我在纵向模式下运行滚动视图时,它的框架看起来很好。如果我将设备从肖像转到风景,它也可以正常工作。但是如果我在横向模式下运行代码,那么滚动视图的框架不会将自身调整为全屏大小。我还通过 XIB 提供了一个自动调整大小的蒙版。但也没有运气。 任何人都可以帮我解决这个问题....谢谢
【问题讨论】:
-
请检查滚动视图在横向启动时的 contentSize,看看它是否是您想要的。
-
实际上,当我处于横向模式时,我什至通过给它一个不同的框架来检查它。但即使这样似乎也不起作用。
标签: iphone ipad uiscrollview