简体   繁体   English

iOS 8上的ViewPort Meta标签出现UIWebView App问题

[英]UIWebView App Issue With ViewPort Meta Tag on iOS 8

I am trying to set the viewport of my iOS 8 UIWebView App to 500 when it loads my html page. 我试图在加载我的HTML页面时将我的iOS 8 UIWebView App的视口设置为500。 This is the code I am using and it worked fine on iOS versions under 8, fitting the whole screen. 这是我正在使用的代码,在8以下的iOS版本上可以正常工作,适合整个屏幕。 But now in iOS 8, it leaves a blank area on the right side. 但是现在在iOS 8中,它在右侧保留了一个空白区域。 Any help is sincerely appreciated. 真诚的感谢您的帮助。

<meta name="viewport" content="width=500, user-scalable=no"/>

Part 1: 第1部分:

Seeing as this is a question about getting the website to fill the entire screen on an iPhone I would highly recommend looking into a responsive css framework such as twitter bootstrap . 看来这是有关使网站在iPhone上充满整个屏幕的问题,我强烈建议您研究一下响应式CSS框架,例如twitter bootstrap

Then instead of setting the screen to 500px the application would adjust to the screen size of the phone. 然后,无需将屏幕设置为500px ,而是将应用程序调整为手机的屏幕尺寸。 This is very useful when working with both portrait and landscape view changes and even moreso now with the addition of the new screen sizes on the iPhone 6 and 6+. 与纵向和横向视图更改工作甚至moreso现在增加了新屏幕尺寸的iPhone 6和6 +时,这是非常有用的。

Part 2: 第2部分:

Now I say that with the understanding that re-writing your UI with a css framework can be a lot of work ( though completely worth it for the benefits ) 现在,我说了这样的理解:用css框架重新编写UI可能需要很多工作( 尽管这样做完全值得

To more directly address your question... If you connect your test device to your mac and open safari and inspect the page (make sure to press the refresh button in the resources tab next to your index.html so it catches all errors and events from page load) do you see any errors or messages about the content="width=500" being invalid or unrecognized? 要更直接地解决您的问题...如果将测试设备连接到Mac并打开Safari浏览器并检查页面(请确保按index.html旁边资源标签中的刷新按钮,以捕获所有错误和事件从页面加载中),您是否看到有关content="width=500"任何错误或消息无效或无法识别?

Note to reviewers: 审稿人注意:

I believe that this is a solution to the OP's issue, not a direct answer to his question. 我认为这是对OP问题的解决方案 ,而不是对他的问题的直接答案。 It answers the issue of his application "fitting the whole screen" and therefore I believe it answers the question's intent. 它回答了他的应用程序“适合整个屏幕”的问题,因此我相信它可以回答问题的意图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM