xcode4 - UIImageView in UIScrollView Issues -


For the last few weeks I have been stuck in a UIIMageView to work correctly with UIScrollView. My image is 320x9100 and what I'm trying to do is get to scroll vertically. By the time I added myimage@2x.png to use for retina display, everything was great, but when the length of the images is different, the scrollview ends before the end of the photo. What is the best way to do this? Any help would be greatly appreciated!

PS I would be more grateful if I can email this project to you and you can fix it for me :)

Thanks in advance !!!

The exode automatically handles retina images.

  [scrollView setContentSize: imageView.frame.size];   

If you are setting the image in the form of a program or in a xib file, then it will work.

There is some code in this explanation that assumes that you have a UIScrollView in your .xib file that is connected to an IBOutlet named ScrollView in your .h file.

  // image UIImage * image = [UIImage imageNamed: @ "myImage.png"]; // Image view UIImageView * imageView = [[UIImageView alloc] initWithImage: Image]; // image view image imageView.frame = CGRectMake (0, 0, imageView.frame.size.width, imageView.frame.size.height); // Add image view to your scroll view [scrollView addSubview: imageView]; // Set scroll view content size to match image view size [scrollView setContentSize: imageView.frame.size];    

Comments