是否可以设置UIImageView图像的位置? [英] Is it possible to set the position of an UIImageView's image?

查看:127
本文介绍了是否可以设置UIImageView图像的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示更大图像的 UIImageView 。它似乎是居中的,但我想将该图像移到 UIImageView 中。我查看了Apple的 MoveMe 示例,但是我无法弄清楚他们是如何做到的。看起来他们甚至没有UIImageView。任何想法?

I have a UIImageView that displays a bigger image. It appears to be centered, but I would like to move that image inside that UIImageView. I looked at the MoveMe sample from Apple, but I couldn't figure out how they do it. It seems that they don't even have an UIImageView for that. Any ideas?

推荐答案

原始答案已被iOS4中的CoreAnimation取代。

Original Answer has been superseded by CoreAnimation in iOS4.

正如Gold Thumb所说:你可以通过访问UIView的CALayer来做到这一点。特别是它的contentRect:

So as Gold Thumb says: you can do this by accessing the UIView's CALayer. Specifically its contentRect:

来自 Apple Docs :单位坐标空间中的矩形,用于定义应使用的图层内容部分。动画。

From the Apple Docs: The rectangle, in the unit coordinate space, that defines the portion of the layer’s contents that should be used. Animatable.

这篇关于是否可以设置UIImageView图像的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆