Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int y = 0;
- int x = 0;
- NSMutableArray *photos = [[NSMutableArray alloc] init];
- for(int z = 1; z < 45 ; z++){
- NSString *ImgName = [NSString stringWithFormat:@"%d.jpg",z];
- [photos addObject:ImgName];
- }
- for(NSString *temp in photos){
- //NSLog(@"on image %@", temp);
- UIImageView *newImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:temp]];
- newImg.contentMode = UIViewContentModeScaleAspectFit;
- newImg.frame = CGRectMake(x+2, y+2, 95, 100);
- [self.scrollView addSubview:newImg];
- [newImg release];
- x = x + 100;
- if(x+100 >= 320){
- x = 0;
- y = y + 110;
- }
- }
- self.scrollView.backgroundColor = [UIColor blackColor];
- self.scrollView.frame = CGRectMake(0, 0, 320, 391);
- self.scrollView.contentSize = CGSizeMake(320, y+150);
- [self.view addSubview:self.scrollView];
- [photos release];
Add Comment
Please, Sign In to add comment