123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // CPDFAddView.m
- // PDFViewer
- //
- // Created by kdanmobile_2 on 2022/12/5.
- //
- #import "PDFAddView.h"
- #import "Masonry.h"
- @implementation PDFAddView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- _localLabel = [[UILabel alloc] init];
- NSArray *arraySegmmentL = [NSArray arrayWithObjects:NSLocalizedString(@"Header", nil), NSLocalizedString(@"Footer", nil), nil];
- _localSegment = [[UISegmentedControl alloc] initWithItems:arraySegmmentL];
-
- [self addSubview:_localLabel];
- [self addSubview:_localSegment];
-
- // Alignment
- _alignmentLabel = [[UILabel alloc] init];
- NSArray *arraySegmmentA = [NSArray arrayWithObjects:NSLocalizedString(@"Left", nil), NSLocalizedString(@"Center", nil), NSLocalizedString(@"Right", nil), nil];
- _aligbmentSegment = [[UISegmentedControl alloc] initWithItems:arraySegmmentA];
-
- [self addSubview:_alignmentLabel];
- [self addSubview:_aligbmentSegment];
-
- // Font color
- _colorLabel = [[UILabel alloc] init];
- _colerImage = [[UIImageView alloc] init];
- _colorSlider = [[UISlider alloc] init];
-
- [self addSubview:_colorLabel];
- [self addSubview:_colorSlider];
- [self addSubview:_colerImage];
- }
- return self;
- }
- #pragma mark - Layout
- - (void)layoutSubviews {
- [super layoutSubviews];
- CGFloat offsetx = 3.5;
-
- // Page number location
- [_localLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.mas_top).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(offsetx);
- make.width.mas_equalTo(150);
- make.height.mas_equalTo(22);
- }];
-
- [_localSegment mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_localLabel.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(4 * offsetx);
- make.right.equalTo(self.mas_right).offset(-4 *offsetx);
- make.height.mas_equalTo(44);
- }];
-
- // Alignment
- [_alignmentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_localSegment.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(offsetx);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(22);
- }];
-
- [_aligbmentSegment mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_alignmentLabel.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(4 * offsetx);
- make.right.equalTo(self.mas_right).offset(-4 *offsetx);
- make.height.mas_equalTo(44);
- }];
-
- // Font color
- [_colorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_aligbmentSegment.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(offsetx);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(22);
- }];
-
- [_colerImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_colorLabel.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(4 * offsetx);
- make.right.equalTo(self.mas_right).offset(-4 *offsetx);
- make.height.mas_equalTo(44);
- }];
-
- [_colorSlider mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_colerImage.mas_bottom).offset(offsetx);
- make.left.equalTo(self.mas_left).offset(4 * offsetx);
- make.right.equalTo(self.mas_right).offset(-4 *offsetx);
- make.height.mas_equalTo(34);
- }];
- }
- @end
|