PhotoPreviewCell.m 875 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // PhotoPreviewCell.m
  3. // RA Image
  4. //
  5. // Created by Jack on 2017/6/14.
  6. // Copyright © 2017年 USAI. All rights reserved.
  7. //
  8. #import "PhotoPreviewCell.h"
  9. @implementation PhotoPreviewCell
  10. - (void)setPhoto:(UIImage *)image {
  11. if (self.photoView) {
  12. // CGFloat width = self.bounds.size.width;
  13. // CGFloat height = self.bounds.size.height;
  14. //
  15. // CGFloat w = image.size.width;
  16. // CGFloat h = image.size.height;
  17. // // 根据图片大小和ScrollView大小等比缩放,使ScrollView容得下图片
  18. // float factor = width / w;
  19. // w = w * factor;
  20. // h = h * factor;
  21. // CGRect frame = CGRectMake(0, (height - h) * 0.5, w, h);
  22. //
  23. // self.photoView.frame = frame;
  24. self.photoView.image = image;
  25. }
  26. }
  27. - (void)layoutSubviews {
  28. [super layoutSubviews];
  29. }
  30. @end