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:
- 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.
- 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);
精彩评论