UIWebView content not scaling between different iPhone sizes

匆匆过客 提交于 2019-11-30 16:10:56
Techie4u

Do check that you haven't coded the dimensions in the .m file.

The answer by Piyush Mathur is simple and seems usable in the given case.

But if the requirements are complex then you need to "Use Auto Layout".

Also make sure that you have set all the needed constraints of the Web-View.

The Introduction to Auto-Layout gives an idea to set constraints to a component which will also give an idea to stretch component (Web-view in your case) based on the device screen size.

To solve such issue,

1) Uncheck "Use Auto layout" and also disable size classes.

2) Open the size inspector to use Autoresizing as directed in the image below on the desired element (in your case its UIWebView).

Try selecting the bounds as per your requirements. This will surely solve your problem.

You could use Xcode's auto layout tool, which will automatically resize the UIWebView according to the device.

I think the best practice is to untick "constraint to margin" when you add the constraints.

Here are three steps: 1. clear all constraints; 2. add the constraints back in and untick "constrain to margin"; 3. set all four constraints to 0.

Or if you are familiar with the Xcode, this can be done in one step.

Arkady

What helped me is a creation of 4 constraints:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!