Guest User

Untitled

a guest
Oct 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. - (void)displayTwoImages {
  2. if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
  3. UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
  4. }
  5. else UIGraphicsBeginImageContext(self.view.bounds.size);
  6. [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
  7. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  8. UIGraphicsEndImageContext();
  9.  
  10. UIImageView *topImage = [[UIImageView alloc] init];
  11. topImage.image = image;
  12. topImage.frame = CGRectMake(0, 0, 320, 215);
  13. topImage.layer.borderWidth = 5;
  14. // topImage.contentMode = UIViewContentModeTop;
  15. [self.view addSubview:topImage];
  16. [topImage release];
  17.  
  18. UIImageView *bottomImage = [[UIImageView alloc] init];
  19. bottomImage.image = image;
  20. bottomImage.frame = CGRectMake(0, 215, 320, 216);
  21. bottomImage.layer.borderWidth = 5;
  22. // bottomImage.contentMode = UIViewContentModeBottom;
  23. [self.view addSubview:bottomImage];
  24. [bottomImage release];
  25. }
Add Comment
Please, Sign In to add comment