|
@@ -6,97 +6,175 @@
|
|
|
//
|
|
|
|
|
|
#import "CPDFBatesAddView.h"
|
|
|
+#import "Masonry.h"
|
|
|
|
|
|
@implementation CPDFBatesAddView
|
|
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
self = [super initWithFrame:frame];
|
|
|
- CGFloat height = self.bounds.size.height / 15 - 35;
|
|
|
- CGFloat width = self.bounds.size.width / 4 - 10;
|
|
|
CGFloat offsetx = 3.5;
|
|
|
if (self) {
|
|
|
//Page number location
|
|
|
- _localLabel = [[UILabel alloc] initWithFrame:CGRectMake(offsetx, offsetx, width * 2, height)];
|
|
|
+ _localLabel = [[UILabel alloc] init];
|
|
|
[_localLabel setText:@"Page number position"];
|
|
|
_localLabel.font = [UIFont boldSystemFontOfSize:12];
|
|
|
NSArray *arraySegmmentL = [NSArray arrayWithObjects:@"Header",@"Footer", nil];
|
|
|
_localSegment = [[UISegmentedControl alloc] initWithItems:arraySegmmentL];
|
|
|
- _localSegment.frame = CGRectMake(3.5, height + 2 * offsetx, self.bounds.size.width - 8 * offsetx, height * 2);
|
|
|
[self addSubview:_localLabel];
|
|
|
[self addSubview:_localSegment];
|
|
|
+ [_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(130);
|
|
|
+ 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.width.mas_equalTo(364);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
//alignment
|
|
|
- _alignmentLabel = [[UILabel alloc] initWithFrame:CGRectMake(3.5, 3 * height + 3 * offsetx, width, height)];
|
|
|
+ _alignmentLabel = [[UILabel alloc] init];
|
|
|
[_alignmentLabel setText:@"alignment"];
|
|
|
_alignmentLabel.font = [UIFont boldSystemFontOfSize:12];
|
|
|
NSArray *arraySegmmentA = [NSArray arrayWithObjects:@"Left",@"Center",@"Right", nil];
|
|
|
_aligbmentSegment = [[UISegmentedControl alloc] initWithItems:arraySegmmentA];
|
|
|
- _aligbmentSegment.frame = CGRectMake(3.5, 4 * height + 4 * offsetx, self.bounds.size.width - 8 * offsetx, height * 2);
|
|
|
[self addSubview:_alignmentLabel];
|
|
|
[self addSubview:_aligbmentSegment];
|
|
|
+ [_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.width.mas_equalTo(364);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
//font color
|
|
|
- _colorLabel = [[UILabel alloc] initWithFrame:CGRectMake(3.5, 6 * height + 5 * offsetx, width, height)];
|
|
|
+ _colorLabel = [[UILabel alloc] init];
|
|
|
[_colorLabel setText:@"Font Color"];
|
|
|
_colorLabel.font = [UIFont boldSystemFontOfSize:12];
|
|
|
- _colerImage = [[UIImageView alloc] initWithFrame:CGRectMake(3.5,7 * height + 6 * offsetx , self.bounds.size.width, 2*height)];
|
|
|
+ _colerImage = [[UIImageView alloc] init];
|
|
|
+ CALayer *layer = [_colerImage layer];
|
|
|
+ layer.borderColor = [[UIColor blackColor] CGColor];
|
|
|
+ layer.borderWidth = 0.5f;
|
|
|
_colerImage.image = [UIImage imageNamed:@"text_color_bar"];
|
|
|
- _colorSlider = [[UISlider alloc] initWithFrame:CGRectMake(3.5,9 * height + 7 * offsetx , self.bounds.size.width - 8 * offsetx, 2 * height)];
|
|
|
+ _colorSlider = [[UISlider alloc] init];
|
|
|
_colorSlider.minimumValue = 0;
|
|
|
- _colorSlider.maximumValue = 90;
|
|
|
+ _colorSlider.maximumValue = 100;
|
|
|
_colorSlider.value = 5;
|
|
|
[self addSubview:_colorLabel];
|
|
|
[self addSubview:_colorSlider];
|
|
|
[self addSubview:_colerImage];
|
|
|
+ [_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.width.mas_equalTo(364);
|
|
|
+ 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.width.mas_equalTo(364);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
//page number
|
|
|
- _pageNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(3.5, 11 * height + 8 * offsetx, width + offsetx, height * 2)];
|
|
|
+ _pageNumberLabel = [[UILabel alloc] init];
|
|
|
[_pageNumberLabel setText:@"Page Text"];
|
|
|
_pageNumberLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
- _pageNumberText = [[UITextField alloc] initWithFrame:CGRectMake(2 * offsetx + width, 11 * height + 8 * offsetx, width - offsetx, height * 2)];
|
|
|
+ _pageNumberText = [[UITextField alloc] init];
|
|
|
_pageNumberText.borderStyle = UITextBorderStyleRoundedRect;
|
|
|
+ _pageNumberText.placeholder = @"text";
|
|
|
[self addSubview:_pageNumberLabel];
|
|
|
[self addSubview:_pageNumberText];
|
|
|
- //font size
|
|
|
- _fontNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(3 * offsetx + width * 2, 11 * height + 8 * offsetx, width, height * 2)];
|
|
|
+ [_pageNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_colorSlider.mas_bottom).offset(offsetx);
|
|
|
+ make.left.equalTo(self.mas_left).offset(offsetx);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ make.width.mas_equalTo(73);
|
|
|
+ }];
|
|
|
+ [_pageNumberText mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_colorSlider.mas_bottom).offset(offsetx);
|
|
|
+ make.left.equalTo(_pageNumberLabel.mas_right).offset(offsetx);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ make.width.mas_equalTo(93);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ //font Name
|
|
|
+ _fontNameLabel = [[UILabel alloc] init];
|
|
|
[_fontNameLabel setText:@"Font Name"];
|
|
|
_fontNameLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
- _fontNameText = [[UITextField alloc] initWithFrame:CGRectMake(2 * offsetx + 3 * width, 11 * height + 8 * offsetx, width, height * 2)];
|
|
|
+ _fontNameText = [[UITextField alloc] init];
|
|
|
_fontNameText.borderStyle = UITextBorderStyleRoundedRect;
|
|
|
+ _fontNameText.placeholder = @"Helvetica";
|
|
|
+ _fontNameText.keyboardType = UIKeyboardTypeDefault;
|
|
|
+ _fontNameText.delegate = self;
|
|
|
[self addSubview:_fontNameLabel];
|
|
|
[self addSubview:_fontNameText];
|
|
|
- //font star
|
|
|
- _pageIndexLabel = [[UILabel alloc] initWithFrame:CGRectMake(offsetx, 13 * height + 9 * offsetx, width, height * 2)];
|
|
|
- [_pageIndexLabel setText:@"Page Star"];
|
|
|
+ [_fontNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_colorSlider.mas_bottom).offset(offsetx);
|
|
|
+ make.left.equalTo(_pageNumberText.mas_right).offset(offsetx + 20);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ make.width.mas_equalTo(73);
|
|
|
+ }];
|
|
|
+ [_fontNameText mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_colorSlider.mas_bottom).offset(offsetx);
|
|
|
+ make.left.equalTo(_fontNameLabel.mas_right).offset(offsetx);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ make.width.mas_equalTo(93);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ //font index
|
|
|
+ _pageIndexLabel = [[UILabel alloc] init];
|
|
|
+ [_pageIndexLabel setText:@"Page Start"];
|
|
|
_pageIndexLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
- _pageIndexNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(offsetx + width, 13 * height + 10 * offsetx, width, height * 2)];
|
|
|
- _pageIndexNumberLabel.backgroundColor = [UIColor whiteColor];
|
|
|
- _pageIndexNumberLabel.textColor = [UIColor blueColor];
|
|
|
- _pageIndexNumberLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
- _pageIndexNumberStepper = [[UIStepper alloc] initWithFrame:CGRectMake(offsetx + width * 2, 13 * height + 11 * offsetx, width, height * 2)];
|
|
|
+ _pageIndexNumberText = [[UITextField alloc] init];
|
|
|
+ _pageIndexNumberText.borderStyle = UITextBorderStyleRoundedRect;
|
|
|
+ _pageIndexNumberText.placeholder = @"1";
|
|
|
+ _pageIndexNumberStepper = [[UIStepper alloc] init];
|
|
|
// The step value is updated in real time as the user interacts
|
|
|
- _pageIndexNumberStepper.continuous = YES; // default = YES
|
|
|
- // The user continues to press and hold, automatically increasing or decreasing
|
|
|
- _pageIndexNumberStepper.autorepeat = YES; // default = YES
|
|
|
- // If set to YES, the value loops between min <-> max
|
|
|
- _pageIndexNumberStepper.wraps = NO; // default = NO
|
|
|
- _pageIndexNumberStepper.minimumValue = 0; // default 0
|
|
|
- _pageIndexNumberStepper.maximumValue = 100; // default 100
|
|
|
- _pageIndexNumberStepper.stepValue = 1; // default 1
|
|
|
+ _pageIndexNumberStepper.continuous = YES;
|
|
|
+ _pageIndexNumberStepper.autorepeat = YES;
|
|
|
+ _pageIndexNumberStepper.wraps = NO;
|
|
|
+ _pageIndexNumberStepper.minimumValue = 1;
|
|
|
+ _pageIndexNumberStepper.maximumValue = 1000;
|
|
|
+ _pageIndexNumberStepper.stepValue = 1;
|
|
|
_pageIndexNumberStepper.value = 1;
|
|
|
- //setting Target-Action
|
|
|
- [_pageIndexNumberStepper addTarget:self
|
|
|
- action:@selector(stepperValueChanged:)
|
|
|
- forControlEvents:UIControlEventValueChanged];
|
|
|
[self addSubview:_pageIndexLabel];
|
|
|
- [self addSubview:_pageIndexNumberLabel];
|
|
|
- [self addSubview:_pageIndexNumberStepper];
|
|
|
-
|
|
|
+ [self addSubview:_pageIndexNumberText];
|
|
|
+ [_pageIndexLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_pageNumberLabel.mas_bottom).offset(offsetx);
|
|
|
+ make.left.equalTo(self.mas_left).offset(offsetx);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ make.width.mas_equalTo(73);
|
|
|
+ }];
|
|
|
+ [_pageIndexNumberText mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(_pageNumberText.mas_bottom).offset(offsetx+5);
|
|
|
+ make.left.equalTo(_pageIndexLabel.mas_right).offset(offsetx);
|
|
|
+ make.height.mas_equalTo(33);
|
|
|
+ make.width.mas_equalTo(93);
|
|
|
+ }];
|
|
|
self.backgroundColor = [UIColor whiteColor];
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
-- (void)stepperValueChanged:(UIStepper *)pageIndexNumberStepper {
|
|
|
- NSString *value = [NSString stringWithFormat:@"%f",pageIndexNumberStepper.value];
|
|
|
- self.pageIndexNumberLabel.text = value;
|
|
|
-}
|
|
|
-
|
|
|
@end
|