Guest User

Untitled

a guest
Aug 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. UIScrollView with UIImageView Portrait to Landscape
  2. scrollGalery = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 40, screenWidth, screenHeight-40)];
  3. scrollGalery.contentSize = CGSizeMake(4000, self.scrollGalery.frame.size.height);
  4. scrollGalery.pagingEnabled = YES;
  5. scrollGalery.backgroundColor = [UIColor clearColor];
  6. scrollGalery.showsHorizontalScrollIndicator = NO;
  7. scrollGalery.showsVerticalScrollIndicator = NO;
  8. scrollGalery.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight);
  9. scrollGalery.contentMode = UIViewContentModeScaleAspectFit;
  10. scrollGalery.autoresizesSubviews = YES;
  11. scrollGalery.delegate = self;
  12. [view addSubview:self.scrollGalery];
  13.  
  14. for (Illustration * illustration in listeIllustrations)
  15. {
  16. NSString * labelIllustration = [NSString stringWithFormat:@"%@", illustration.label];
  17. NSString * urlIllustration = [NSString stringWithFormat:@"%@", illustration.url];
  18. labelU.text = labelIllustration;
  19.  
  20. imageViewSV = [[UIImageView alloc] initWithFrame:CGRectMake(x, 20, scrollGalery.frame.size.width,scrollGalery.frame.size.height-80)];
  21. imageViewSV.backgroundColor = [UIColor clearColor];
  22. imageViewSV.contentMode = UIViewContentModeScaleAspectFit;
  23. imageViewSV.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin);
  24. imageViewSV.autoresizesSubviews = YES;
  25. [[SnSImageViewDownloadImageOperation alloc] initAndEnqueueWith:YES
  26. andTarget:imageViewSV
  27. andUrl:urlIllustration
  28. andTemporaryImage:nil];
  29. [self.scrollGalery addSubview:imageViewSV];
  30.  
  31. UITextView * textView = [[UITextView alloc] initWithFrame:CGRectMake(x+40, 400, screenWidth-80, 60)];
  32. textView.backgroundColor = [UIColor clearColor];
  33. textView.textAlignment = UITextAlignmentCenter;
  34. textView.font = FONT_DEFAULT(12);
  35. textView.text = illustration.copy;
  36. textView.editable = NO;
  37. [self.scrollGalery addSubview:textView];
  38.  
  39. x += imageViewSV.frame.size.width;
  40. }
  41. self.scrollGalery.contentSize = CGSizeMake(x, screenHeight-navigationBarHeight);
Add Comment
Please, Sign In to add comment