HomePageADCustomCell.m 963 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // HomePageADCustomCell.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/25.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "HomePageADCustomCell.h"
  9. @interface HomePageADCustomCell ()
  10. @end
  11. @implementation HomePageADCustomCell
  12. #pragma mark - Life Cycle
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. self = [super initWithFrame:frame];
  15. if (self) {
  16. self.backgroundColor = UIColor.whiteColor;
  17. [self addSubview:self.imageView];
  18. }
  19. return self;
  20. }
  21. - (void)layoutSubviews {
  22. [super layoutSubviews];
  23. [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.center.mas_equalTo(self);
  25. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width - 20, self.bounds.size.height - 20));
  26. }];
  27. }
  28. #pragma mark - Lazy Load
  29. - (UIImageView *)imageView {
  30. if (!_imageView) {
  31. _imageView = [[UIImageView alloc] initWithFrame:self.frame];
  32. _imageView.layer.cornerRadius = 5;
  33. _imageView.clipsToBounds = YES;
  34. }
  35. return _imageView;
  36. }
  37. @end