ios - 在 iOS 5 和 iOS 6 中缩放 UIWebView 以适应全屏

标签 ios xcode ios6

我在缩放 UIWebView 时遇到问题。我希望 WebView 在两个版本(iOS5 和 iOS6)上全屏运行。我必须关闭“使用自动布局”才能让我的应用程序也在 iOS5 上运行。我的问题是我的 webView 高于 iOS5 屏幕。

我的问题:

有没有办法让 View 适合两种设备?

最佳答案

您需要手动编写 View 代码,以根据屏幕尺寸更改尺寸。

您可以获取屏幕尺寸(特别是高度):

[[UIScreen mainScreen] bounds].size.height;
[[UIScreen mainScreen] bounds].size.width;

然后使用这些值设置 UIWebView 的大小。

webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, [[UIScreen mainScreen] bounds].size.height)];

关于ios - 在 iOS 5 和 iOS 6 中缩放 UIWebView 以适应全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15604945/

相关文章:

ios - 如何在 iOS 6 上创建和保存 EKCalendar

iphone - 在 iPhone 中使用哪种方法从视频中提取帧?

objective-c - 排序数组并在数组开头添加元素

ios - EXC_BAD_ACCESS KERN_INVALID_ADDRESS 在 Swift 和 iPhone 5 中

xcode - 简单菜单应用程序内存溢出

ios - swift : How do I pass the same text and image form tableVC to a detailVC using the same tableviewcell?

iOS - 内存和保留/释放问题

ios - UIPickerView 宽度约束问题

iphone - MailComposeViewController - 当我按下按钮 "Cancel"时,我看不到带有 "Draft","Save Draft"和 "Cancel"按钮的面板

ios - 更新大小未知的多行 UILabel 的 preferredMaxLayoutWidth(自动布局)