简体   繁体   English

方向改变时在UIWebView中横向和纵向查找图像位置

[英]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.

相关问题 当方向从横向更改为纵向时,UInavigationbar背景图像无法正确调整大小 - UInavigationbar background image does not resize correctly when orientation changes from landscape to portrait UIWebView更改方向时更改图像 - UIWebView change image when orientation changes UIImagePNGRepresentation以横向保存肖像图像 - UIImagePNGRepresentation save a portrait image in landscape orientation 横向模态在被解雇时切换为纵向 - Modal in landscape orientation swaps to portrait when dismissed 当 iPhone 方向从纵向变为横向时保留 HTML 字体大小 - Preserve HTML font-size when iPhone orientation changes from portrait to landscape 方向肖像和风景模式 - Orientation portrait and landscape mode iPhone的自定义选项卡栏将选项卡纵向更改为横向 - Custom Tab Bar for iPhone changes tabs portrait to landscape orientation UIWebView框架在加载横向和纵向时填充屏幕 - UIWebView frame to fill screen when loaded landscape and portrait 如何为横向和纵向创建图像集? - How to create image set for both landscape and portrait orientation? iphone - 当设备处于纵向时,以编程方式将系统键盘旋转到横向 - iphone - programmatically rotate system keyboard to landscape when device is in portrait orientation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM