123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // 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 = 33;
- [self addSubview:_tableView];
-
- // Title
- _titleView = [[UILabel alloc] init];
- _titleView.font = [UIFont systemFontOfSize:12.0f];
- _titleView.textColor = [UIColor blackColor];
- _titleView.backgroundColor = [UIColor systemGray5Color];
- _titleView.text = titleName;
- _titleView.textAlignment = NSTextAlignmentCenter;
- _titleView.textColor = [UIColor whiteColor];
- [self addSubview:_titleView];
-
-
- // View button at the bottom
- _bottomView = [[UIView alloc] init];
- _bottomView.backgroundColor = [UIColor systemGray5Color];
- [self addSubview:_bottomView];
-
- // OK
- _okBtn = [[UIButton alloc] init];
- [_okBtn setTitle:@"OK" forState:UIControlStateNormal];
- _okBtn.titleLabel.font = [UIFont systemFontOfSize:12];
- _okBtn.backgroundColor = [UIColor systemGray3Color];
- }
- 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(33);
- }];
-
- // View button at the bottom
- [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.tableView.mas_bottom);
- make.left.equalTo(self.mas_left);
- make.right.equalTo(self.mas_right);
- make.height.mas_equalTo(44);
- }];
-
- // OK
- [self.bottomView addSubview:_okBtn];
- [self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.bottomView.mas_top).offset(6);
- make.right.equalTo(self.bottomView.mas_right).offset(-60);
- make.height.mas_equalTo(33);
- make.width.mas_equalTo(40);
- }];
- }
- @end
|