5
votes

I am developing an app for iPhone/iPad using Objective C. In my app I am having an UiScrollView which is having an UIImageView inside it. I can scroll and Zoom the Image inside the Scroll View.

All works fine.But my problem is that when I am loading the Image Inside a uiscrollview, its position is at something at center but not exactly.

I want that either my image should be center aligned or at the Top Left corner.

I had set the contentoffset to (0,0) and also tried setting the AutoresizingMask to different values.

Please let me know if somebody has any idea or solution.

1

1 Answers

9
votes

contentoffset is something of the scrollview and is probably not right for this situation. If you want the image to be in the center do this:

imageview.center = scrollview.center;

If you want the image to be at the top left corner of the scrollview do this:

imageview.frame = CGRectMake(0,0,image_width,image_height);

Good luck!