简体   繁体   English

创建和调整UIImageView的大小

[英]Creating and Resizing a UIImageView

I would like to be able to add UIImageViews to my screen and also be able to re-size them, rotate them etc during run-time. 我希望能够将UIImageViews添加到屏幕上,并且还能够在运行时调整它们的大小,旋转它们等。

How are the images resized, rotated etc.? 图像如何调整大小,旋转等? Is openGl needed for this? 为此需要openGl吗?

thanks 谢谢

You can use view .transform property to get scaling and rotation ( CGAffineTransform ) or you could go lower and use view layer and CoreAnimation power for more advanced effects. 您可以使用view .transform属性获取缩放和旋转(CGAffineTransform),或者可以降低视图的使用图层和CoreAnimation的功能来获得更高级的效果。

Cheers, Krzysztof Zabłocki 干杯,KrzysztofZabłocki

About resizing you can use the frame property of the UIImageView 关于调整大小,您可以使用UIImageView的frame属性

About rotating, you should try applying a transform to the UIImageView like : 关于旋转,您应该尝试对UIImageView进行如下转换:

yourView.transform = CGAffineTransformMakeRotation(45.0*M_PI/180.0);

Good Luck ! 祝好运 !

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

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