[英]finding image position in landscape and portrait in UIWebView when orientation changes
I have a UIWebView which loads images on it. 我有一个UIWebView在其上加载图像。 Obviously on portrait the image will have a different origin x and y point and width and height comparing to the landscape.
显然,在肖像上,与风景相比,图像将具有不同的原点x和y点以及宽度和高度。 Question is how do I find this origin x and y when orientation changes?
问题是当方向改变时如何找到该原点x和y? Do I have to inject a js function that finds this number everytime the orientation change or is there an easier way?
我是否必须注入一个js函数,以便每次更改方向时都能找到该数字,还是有更简单的方法?
If you center your image inside of the UIWebView
, then make the UIWebView
auto-resize so it takes the full available width, you have no need to use JS to know how large the image is. 如果将图像居中于
UIWebView
,然后使UIWebView
自动调整大小以使其占据全部可用宽度,则无需使用JS即可知道图像的大小。
I don't know if this suggestion applies to your specific case, I hope it does. 我不知道此建议是否适用于您的特定情况,希望如此。 Otherwise, please provide more details.
否则,请提供更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.