Search code examples
iphoneimageuiimageview

Is it possible to set the position of an UIImageView's image?


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?


Solution

  • Original Answer has been superseded by CoreAnimation in iOS4.

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

    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.