开发者

iPhone positioning a UIImageView with code? Sure it's simple to solve

This is very simple so I'm not sure why I can't do this. All I want to do it position some UIImageViews when my app becomes active. I had been using CGAffineTransformMakeTranslation but I can now see that this is not correct because it moves the view a set amount r开发者_Python百科ather than moving it to a set position. What should I be using?


You could just change the frame of your UIImageView to:

  1. set the x and y origin of the frame to the position you want your UIImageView to be placed with respect to the containing view.
  2. keep the width and height of your UIImageView the same

Something like this:

imageView.frame = CGRectMake([desired x coordinate], [desired y coordinate], imageView.frame.size.width, imageView.frame.size.height);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜