PDFHeadFooterPreView.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // CPDFHeadView.m
  3. // PDFViewer
  4. //
  5. // Created by kdanmobile_2 on 2022/12/7.
  6. //
  7. #import "PDFHeadFooterPreView.h"
  8. @implementation PDFHeadFooterPreView
  9. - (instancetype)initWithFrame:(CGRect)frame {
  10. self = [super initWithFrame:frame];
  11. if (self) {
  12. self.preLabel = [[UILabel alloc] init];
  13. [self.preLabel setText:@"1"];
  14. self.preLabel.font = [UIFont systemFontOfSize:6];
  15. [self.documentImageView addSubview:self.preLabel];
  16. }
  17. return self;
  18. }
  19. - (void)drawRect:(CGRect)rect {
  20. [super drawRect:rect];
  21. [self.documentImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.top.equalTo(self.mas_top);
  23. make.left.equalTo(self.mas_left);
  24. make.width.mas_equalTo(self.image.size.width / 9);
  25. make.height.mas_equalTo(self.image.size.height / 9);
  26. }];
  27. [self.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  28. make.top.equalTo(self.documentImageView.mas_top).offset(0.5);
  29. make.left.equalTo(self.documentImageView.mas_left).offset(0.5);
  30. make.height.mas_equalTo(10);
  31. make.width.mas_equalTo(20);
  32. }];
  33. }
  34. @end