ios – 使用图像的确切大小创建UIImageVIew

ios – 使用图像的确切大小创建UIImageVIew,第1张

概述如何从图像中检测尺寸,然后使用该尺寸创建UI ImageView,完美贴合图像内部? 只需像这样创建UIImageView: UIImageView *aImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]]; 因此ImageView具有图像的大小.从UIImageView的文档: 如何从图像中检测尺寸,然后使用该尺寸创建UI ImageVIEw,完美贴合图像内部?解决方法 只需像这样创建UIImageVIEw:

UIImageVIEw *aimageVIEw = [[UIImageVIEw alloc] initWithImage:[UIImage imagenamed:@"yourImage.png"]];

因此ImageVIEw具有图像的大小.从UIImageVIEw的文档:

This method adjusts the frame of the receiver to match the size of the specifIEd image. It also disables user interactions for the image vIEw by default.

我希望我的回答可以帮到你. 总结

以上是内存溢出为你收集整理的ios – 使用图像的确切大小创建UIImageVIew全部内容,希望文章能够帮你解决ios – 使用图像的确切大小创建UIImageVIew所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1007162.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存