/ Published in: Objective C

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#define IMAGE_WIDTH 320 #define IMAGE_HEIGHT 416 - (void)viewDidLoad { [super viewDidLoad]; // note that the view contains a UIScrollView in aScrollView int i=0; { UIImage *image = [UIImage imageNamed:[photos objectAtIndex:i]]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; imageView.contentMode = UIViewContentModeScaleAspectFit; imageView.clipsToBounds = YES; imageView.frame = CGRectMake( IMAGE_WIDTH * i++, 0, IMAGE_WIDTH, IMAGE_HEIGHT); [aScrollView addSubview:imageView]; [imageView release]; } aScrollView.contentSize = CGSizeMake(IMAGE_WIDTH*i, IMAGE_HEIGHT); aScrollView.delegate = self; }
URL: http://www.chewyapps.com/2009/09/01/images-in-a-scroll-view/
Comments
