Created
February 7, 2011 02:12
-
-
Save maxkramer/813923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define IMAGE_WIDTH 320 | |
#define IMAGE_HEIGHT 480 | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSArray *photos = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"1.jpg"],[UIImage imageNamed:@"2.jpg"],[UIImage imageNamed:@"3.png"],[UIImage imageNamed:@"4.jpg"], nil]; // TODO – fill with your photos | |
// note that the view contains a UIScrollView in aScrollView | |
int i=0; | |
for ( NSString *image in photos ) | |
{ | |
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); | |
[scrollView addSubview:imageView]; | |
[imageView release]; | |
} | |
scrollView.contentSize = CGSizeMake(IMAGE_WIDTH*i, IMAGE_HEIGHT); | |
scrollView.delegate = self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment