1

我正在创建一个具有滚动视图的通用应用程序。

该应用程序在 iPhone 和 iPad 上运行良好。但是,滚动视图设置为 iPad 尺寸。因此,当我在 iPhone 上运行该应用程序时,仍然为 iPad 设置了滚动视图。

有什么办法可以改变吗?

4

1 回答 1

3

你可以使用这个:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    [myScrollView setFrame:CGRectMake(0, 0, 320, 480)];
}else{
    [myScrollView setFrame:CGRectMake(0, 0, 768, 1024)];
}

当然,您还必须调整滚动视图的内容大小。

于 2012-09-05T15:21:56.550 回答