Guest User

Untitled

a guest
Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. int y = 0;
  2. int x = 0;
  3. NSMutableArray *photos = [[NSMutableArray alloc] init];
  4. for(int z = 1; z < 45 ; z++){
  5. NSString *ImgName = [NSString stringWithFormat:@"%d.jpg",z];
  6. [photos addObject:ImgName];
  7. }
  8. for(NSString *temp in photos){
  9. //NSLog(@"on image %@", temp);
  10. UIImageView *newImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:temp]];
  11. newImg.contentMode = UIViewContentModeScaleAspectFit;
  12. newImg.frame = CGRectMake(x+2, y+2, 95, 100);
  13. [self.scrollView addSubview:newImg];
  14. [newImg release];
  15. x = x + 100;
  16.  
  17. if(x+100 >= 320){
  18. x = 0;
  19. y = y + 110;
  20. }
  21. }
  22. self.scrollView.backgroundColor = [UIColor blackColor];
  23. self.scrollView.frame = CGRectMake(0, 0, 320, 391);
  24.  
  25. self.scrollView.contentSize = CGSizeMake(320, y+150);
  26. [self.view addSubview:self.scrollView];
  27. [photos release];
Add Comment
Please, Sign In to add comment