// // CPDFHeaderFooterTextTableView.m // PDFViewer // // Created by kdanmobile_2 on 2022/11/25. // #import "CPDFHeaderFooterTextTableView.h" @implementation CPDFHeaderFooterTextTableView - (instancetype)initWithTitleName:(NSString *)titleName { self = [super init]; if (self) { // Tableview _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.rowHeight = 55; [self addSubview:_tableView]; // Title _titleView = [[UILabel alloc] init]; _titleView.font = [UIFont systemFontOfSize:15.0f]; _titleView.textColor = [UIColor blackColor]; _titleView.backgroundColor = [UIColor systemGray5Color]; _titleView.text = titleName; _titleView.textAlignment = NSTextAlignmentCenter; _titleView.textColor = [UIColor whiteColor]; [self addSubview:_titleView]; // OK _okBtn = [[UIButton alloc] init]; _okBtn.backgroundColor = [UIColor systemGray5Color]; [_okBtn setTitle:@"Back" forState:UIControlStateNormal]; _okBtn.imageView.image = [UIImage imageNamed:@"btn_frontpage"]; [self addSubview:_okBtn]; } return self; } #pragma mark - Layout - (void)layoutSubviews { [super layoutSubviews]; // Tableview [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.mas_top).offset(33); make.left.equalTo(self.mas_left); make.right.equalTo(self.mas_right); make.bottom.equalTo(self.mas_bottom).offset(-44); }]; // Title [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.mas_top); make.left.equalTo(self.mas_left); make.right.equalTo(self.mas_right); make.height.mas_equalTo(55); }]; // OK [self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.titleView.mas_top).offset(5); make.left.equalTo(self.titleView.mas_left); make.height.mas_equalTo(44); make.width.mas_equalTo(60); }]; } @end