// // CPDFHeadView.m // PDFViewer // // Created by kdanmobile_2 on 2022/12/7. // #import "PDFHeadFooterPreView.h" @implementation PDFHeadFooterPreView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.preLabel = [[UILabel alloc] init]; [self.preLabel setText:@"1"]; self.preLabel.font = [UIFont systemFontOfSize:6]; [self.documentImageView addSubview:self.preLabel]; } return self; } - (void)drawRect:(CGRect)rect { [super drawRect:rect]; [self.documentImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.mas_top); make.left.equalTo(self.mas_left); make.width.mas_equalTo(self.image.size.width / 9); make.height.mas_equalTo(self.image.size.height / 9); }]; [self.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.documentImageView.mas_top).offset(0.5); make.left.equalTo(self.documentImageView.mas_left).offset(0.5); make.height.mas_equalTo(10); make.width.mas_equalTo(20); }]; } @end