|
@@ -9,37 +9,269 @@
|
|
|
|
|
|
#import "CPDFImagePropertyCell.h"
|
|
|
#import "CPDFDropDownMenu.h"
|
|
|
+#import "CPDFOpacitySliderView.h"
|
|
|
|
|
|
@interface CPDFImagePropertyCell()<CPDFDropDownMenuDelegate>
|
|
|
|
|
|
-@property (weak, nonatomic) IBOutlet UIView *opacityView;
|
|
|
@property (nonatomic, strong) CPDFDropDownMenu * menu;
|
|
|
@property (weak, nonatomic) IBOutlet UISlider *transparencySlider;
|
|
|
|
|
|
-@end
|
|
|
+@property (nonatomic, strong) UILabel *rotateLabel;
|
|
|
+@property (nonatomic, strong) UILabel *transformLabel;
|
|
|
+@property (nonatomic, strong) UILabel *opacityLabel;
|
|
|
+@property (nonatomic, strong) UILabel *toolsLabel;
|
|
|
|
|
|
-@implementation CPDFImagePropertyCell
|
|
|
+@property (nonatomic, strong) UIView * leftRotateView;
|
|
|
+@property (nonatomic, strong) UILabel * leftRotateLabel;
|
|
|
+@property (nonatomic, strong) UIImageView * leftImageView;
|
|
|
+@property (nonatomic, strong) UIButton * leftRotateBtn;
|
|
|
|
|
|
+@property (nonatomic, strong) UIView * rightRotateView;
|
|
|
+@property (nonatomic, strong) UILabel * rightRorateLabel;
|
|
|
+@property (nonatomic, strong) UIImageView * rightImageView;
|
|
|
+@property (nonatomic, strong) UIButton * rightRotateBtn;
|
|
|
|
|
|
-+(instancetype)CPDFImagePropertyCell {
|
|
|
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
|
|
- return [[bundle loadNibNamed:@"CPDFImagePropertyCell" owner:nil options:nil] lastObject];
|
|
|
-}
|
|
|
+@property (nonatomic, strong) UIView * transformView;
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIButton * hBtn;
|
|
|
+@property (nonatomic, strong) UIButton * vBtn;
|
|
|
+
|
|
|
+@property (nonatomic, strong) CPDFOpacitySliderView * opacityView;
|
|
|
|
|
|
+@property (nonatomic, strong) UIView * replaceView;
|
|
|
+@property (nonatomic, strong) UILabel * replaceLabel;
|
|
|
+@property (nonatomic, strong) UIImageView * replaceImageView;
|
|
|
+@property (nonatomic, strong) UIButton * replaceBtn;
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIView * exportView;
|
|
|
+@property (nonatomic, strong) UILabel * exportLabel;
|
|
|
+@property (nonatomic, strong) UIImageView * exportImageView;
|
|
|
+@property (nonatomic, strong) UIButton * exportBtn;
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIView * cropView;
|
|
|
+@property (nonatomic, strong) UILabel * cropLabel;
|
|
|
+@property (nonatomic, strong) UIImageView * cropImageView;
|
|
|
+@property (nonatomic, strong) UIButton * cropBtn;
|
|
|
+
|
|
|
+
|
|
|
+@end
|
|
|
|
|
|
+@implementation CPDFImagePropertyCell
|
|
|
+
|
|
|
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
+ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
|
+
|
|
|
+ self.rotateLabel = [[UILabel alloc] init];
|
|
|
+ self.rotateLabel.font = [UIFont systemFontOfSize:13];
|
|
|
+ self.rotateLabel.text = NSLocalizedString(@"Rotate", nil);
|
|
|
+ self.rotateLabel.textColor = [UIColor colorWithRed:153./255 green:153./255 blue:153./255 alpha:1.];
|
|
|
+ [self.contentView addSubview:self.rotateLabel];
|
|
|
+
|
|
|
+ self.leftRotateView = [[UIView alloc] init];
|
|
|
+ self.leftRotateView.layer.borderWidth = 1;
|
|
|
+ self.leftRotateView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ [self.contentView addSubview:self.leftRotateView];
|
|
|
+
|
|
|
+ self.leftImageView = [[UIImageView alloc] init];
|
|
|
+ self.leftImageView.image = [UIImage imageNamed:@"CPDFEditIRotate" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
|
|
|
+ [self.leftRotateView addSubview:self.leftImageView];
|
|
|
+
|
|
|
+ self.leftRotateLabel = [[UILabel alloc] init];
|
|
|
+ self.leftRotateLabel.text = NSLocalizedString(@"Left", nil);
|
|
|
+ self.leftRotateLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.leftRotateLabel.textColor = [UIColor colorWithRed:67/255. green:71/255. blue:77/255. alpha:1.];
|
|
|
+ [self.leftRotateView addSubview:self.leftRotateLabel];
|
|
|
+
|
|
|
+ self.leftRotateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.leftRotateBtn addTarget:self action:@selector(leftRotateAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.leftRotateView addSubview:self.leftRotateBtn];
|
|
|
+
|
|
|
+
|
|
|
+ self.rightRotateView = [[UIView alloc] init];
|
|
|
+ self.rightRotateView.layer.borderWidth = 1;
|
|
|
+ self.rightRotateView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ [self.contentView addSubview:self.rightRotateView];
|
|
|
+
|
|
|
+ self.rightImageView = [[UIImageView alloc] init];
|
|
|
+ self.rightImageView.image = [UIImage imageNamed:@"CPDFEditRRotate" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
|
|
|
+ [self.rightRotateView addSubview:self.rightImageView];
|
|
|
+
|
|
|
+ self.rightRorateLabel = [[UILabel alloc] init];
|
|
|
+ self.rightRorateLabel.text = NSLocalizedString(@"Right", nil);
|
|
|
+ self.rightRorateLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.rightRorateLabel.textColor = [UIColor colorWithRed:67/255. green:71/255. blue:77/255. alpha:1.];
|
|
|
+ [self.rightRotateView addSubview:self.rightRorateLabel];
|
|
|
+
|
|
|
+ self.rightRotateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.rightRotateBtn addTarget:self action:@selector(rightRotateAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.rightRotateView addSubview:self.rightRotateBtn];
|
|
|
+
|
|
|
+
|
|
|
+ self.transformLabel = [[UILabel alloc] init];
|
|
|
+ self.transformLabel.font = [UIFont systemFontOfSize:13];
|
|
|
+ self.transformLabel.text = NSLocalizedString(@"Transform", nil);
|
|
|
+ self.transformLabel.textColor = [UIColor colorWithRed:153./255 green:153./255 blue:153./255 alpha:1.];
|
|
|
+ [self.contentView addSubview:self.transformLabel];
|
|
|
+
|
|
|
+ self.transformView = [[UIView alloc] init];
|
|
|
+ self.transformView.layer.borderWidth = 1;
|
|
|
+ self.transformView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.2].CGColor;
|
|
|
+ [self.contentView addSubview:self.transformView];
|
|
|
+
|
|
|
+ self.vBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.vBtn setImage:[UIImage imageNamed:@"CPDFEditVerticalFlip" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
|
|
|
+ [self.vBtn addTarget:self action:@selector(verticalAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
+ self.hBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.hBtn setImage:[UIImage imageNamed:@"CPDFEditHorizontalFlip" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
|
|
|
+ [self.hBtn addTarget:self action:@selector(horizontalAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
+ [self.transformView addSubview:self.hBtn];
|
|
|
+ [self.transformView addSubview:self.vBtn];
|
|
|
+
|
|
|
+ self.opacityLabel = [[UILabel alloc] init];
|
|
|
+ self.opacityLabel.font = [UIFont systemFontOfSize:13];
|
|
|
+ self.opacityLabel.text = NSLocalizedString(@"Opacity", nil);
|
|
|
+ self.opacityLabel.textColor = [UIColor colorWithRed:153./255 green:153./255 blue:153./255 alpha:1.];
|
|
|
+ [self.contentView addSubview:self.opacityLabel];
|
|
|
+
|
|
|
+ self.opacityView = [[CPDFOpacitySliderView alloc] init];
|
|
|
+ self.opacityView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
|
|
+ self.opacityView.titleLabel.text = NSLocalizedString(@"", nil);
|
|
|
+ self.opacityView.startLabel.text = @"0";
|
|
|
+ self.opacityView.opacitySlider.value = 0.14;
|
|
|
+ self.opacityView.delegate = self;
|
|
|
+ [self.contentView addSubview:self.opacityView];
|
|
|
+
|
|
|
+ self.toolsLabel = [[UILabel alloc] init];
|
|
|
+ self.toolsLabel.font = [UIFont systemFontOfSize:13];
|
|
|
+ self.toolsLabel.text = NSLocalizedString(@"Tools", nil);
|
|
|
+ self.toolsLabel.textColor = [UIColor colorWithRed:153./255 green:153./255 blue:153./255 alpha:1.];
|
|
|
+ [self.contentView addSubview:self.toolsLabel];
|
|
|
+
|
|
|
+ self.replaceView = [[UIView alloc] init];
|
|
|
+ self.replaceView.layer.borderWidth = 1;
|
|
|
+ self.replaceView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ [self.contentView addSubview:self.replaceView];
|
|
|
+
|
|
|
+
|
|
|
+ self.replaceImageView = [[UIImageView alloc] init];
|
|
|
+ self.replaceImageView.image = [UIImage imageNamed:@"CPDFEditReplace" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
|
|
|
+ [self.replaceView addSubview:self.replaceImageView];
|
|
|
+
|
|
|
+ self.replaceLabel = [[UILabel alloc] init];
|
|
|
+ self.replaceLabel.text = NSLocalizedString(@"Replace", nil);
|
|
|
+ self.replaceLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.replaceLabel.textColor = [UIColor colorWithRed:67/255. green:71/255. blue:77/255. alpha:1.];
|
|
|
+ [self.replaceView addSubview:self.replaceLabel];
|
|
|
+
|
|
|
+ self.replaceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.replaceBtn addTarget:self action:@selector(replaceImageAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.replaceView addSubview:self.replaceBtn];
|
|
|
+
|
|
|
+
|
|
|
+ self.exportView = [[UIView alloc] init];
|
|
|
+ self.exportView.layer.borderWidth = 1;
|
|
|
+ self.exportView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ [self.contentView addSubview:self.exportView];
|
|
|
+
|
|
|
+
|
|
|
+ self.exportImageView = [[UIImageView alloc] init];
|
|
|
+ self.exportImageView.image = [UIImage imageNamed:@"CPDFEditExport" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
|
|
|
+ [self.exportView addSubview:self.exportImageView];
|
|
|
+
|
|
|
+ self.exportLabel = [[UILabel alloc] init];
|
|
|
+ self.exportLabel.text = NSLocalizedString(@"Export", nil);
|
|
|
+ self.exportLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.exportLabel.textColor = [UIColor colorWithRed:67/255. green:71/255. blue:77/255. alpha:1.];
|
|
|
+ [self.exportView addSubview:self.exportLabel];
|
|
|
+
|
|
|
+ self.exportBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.exportBtn addTarget:self action:@selector(exportImageAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.exportView addSubview:self.exportBtn];
|
|
|
+
|
|
|
+
|
|
|
+ self.cropView = [[UIView alloc] init];
|
|
|
+ self.cropView.layer.borderWidth = 1;
|
|
|
+ self.cropView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ [self.contentView addSubview:self.cropView];
|
|
|
+
|
|
|
+
|
|
|
+ self.cropImageView = [[UIImageView alloc] init];
|
|
|
+ self.cropImageView.image = [UIImage imageNamed:@"CPDFEditCrop" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
|
|
|
+ [self.cropView addSubview:self.cropImageView];
|
|
|
+
|
|
|
+ self.cropLabel = [[UILabel alloc] init];
|
|
|
+ self.cropLabel.text = NSLocalizedString(@"Crop", nil);
|
|
|
+ self.cropLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.cropLabel.textColor = [UIColor colorWithRed:67/255. green:71/255. blue:77/255. alpha:1.];
|
|
|
+ [self.cropView addSubview:self.cropLabel];
|
|
|
+
|
|
|
+ self.cropBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [self.cropBtn addTarget:self action:@selector(cropImageAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.cropView addSubview:self.cropBtn];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
|
|
|
-- (void)awakeFromNib {
|
|
|
- [super awakeFromNib];
|
|
|
- // Initialization code
|
|
|
- self.menu = [[CPDFDropDownMenu alloc] initWithFrame:self.opacityView.bounds];
|
|
|
- [self.opacityView addSubview:self.menu];
|
|
|
- self.menu.delegate = self;
|
|
|
+- (void)layoutSubviews {
|
|
|
+ [super layoutSubviews];
|
|
|
+
|
|
|
+ self.rotateLabel.frame = CGRectMake(16, 0, self.bounds.size.width, 20);
|
|
|
+
|
|
|
+ self.leftRotateView.frame = CGRectMake(16, CGRectGetMaxY(self.rotateLabel.frame) + 12, (self.bounds.size.width - 16*2 - 8)/2, 32);
|
|
|
+
|
|
|
+ self.leftImageView.frame = CGRectMake(self.leftRotateView.bounds.size.width/2-20, 10, 15, 15);
|
|
|
+ self.leftRotateLabel.frame = CGRectMake(self.leftRotateView.bounds.size.width/2 + 5, 8, self.leftRotateView.bounds.size.width/2, 20);
|
|
|
+ self.leftRotateBtn.frame = self.leftRotateView.bounds;
|
|
|
+
|
|
|
|
|
|
- self.menu.options = [[NSMutableArray alloc]initWithObjects:@"1.0",@"0.75",@"0.5",@"0.25",nil];
|
|
|
- self.menu.menuHeight = 200;
|
|
|
+ self.rightRotateView.frame = CGRectMake(CGRectGetMaxX(self.leftRotateView.frame) + 4, CGRectGetMaxY(self.rotateLabel.frame) + 12, (self.bounds.size.width - 16*2 -8)/2, 32);
|
|
|
|
|
|
- self.transparencySlider.value = 1.;
|
|
|
- self.menu.defaultValue = @"1.0";
|
|
|
+ self.rightImageView.frame = CGRectMake(self.rightRotateView.bounds.size.width/2-20, 10, 15, 15);
|
|
|
+ self.rightRorateLabel.frame = CGRectMake(self.rightRotateView.bounds.size.width/2 + 5, 8, self.rightRotateView.bounds.size.width/2, 20);
|
|
|
+ self.rightRotateBtn.frame = self.rightRotateView.bounds;
|
|
|
+
|
|
|
+ self.transformLabel.frame = CGRectMake(16, CGRectGetMaxY(self.leftRotateView.frame) + 16, self.bounds.size.width, 20);
|
|
|
+
|
|
|
+ self.transformView.frame = CGRectMake(16, CGRectGetMaxY(self.transformLabel.frame) + 16, 100, 32);
|
|
|
+ self.hBtn.frame = CGRectMake(0, 0, 50, 32);
|
|
|
+ self.vBtn.frame = CGRectMake(50, 0, 50, 32);
|
|
|
+
|
|
|
+
|
|
|
+ self.opacityLabel.frame = CGRectMake(16, CGRectGetMaxY(self.transformView.frame) + 16, self.bounds.size.width, 20);
|
|
|
+
|
|
|
+ self.opacityView.frame = CGRectMake(16, CGRectGetMaxY(self.opacityLabel.frame)+ 10, self.frame.size.width-20, 60);
|
|
|
+
|
|
|
+ self.toolsLabel.frame = CGRectMake(16, CGRectGetMaxY(self.opacityView.frame) + 16, self.bounds.size.width, 20);
|
|
|
+
|
|
|
+
|
|
|
+ self.replaceView.frame = CGRectMake(16, CGRectGetMaxY(self.toolsLabel.frame) + 16,(self.bounds.size.width - 16 * 2 - 8*2)/3, 32);
|
|
|
+
|
|
|
+ self.replaceImageView.frame = CGRectMake(self.replaceView.bounds.size.width/2-20, 10, 15, 15);
|
|
|
+ self.replaceLabel.frame = CGRectMake(self.replaceView.bounds.size.width/2 + 5, 8, self.leftRotateView.bounds.size.width/2, 20);
|
|
|
+ self.replaceBtn.frame = self.replaceView.bounds;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ self.exportView.frame = CGRectMake(CGRectGetMaxX(self.replaceView.frame) + 8, CGRectGetMaxY(self.toolsLabel.frame) + 16,(self.bounds.size.width - 16 * 2 - 8*2)/3, 32);
|
|
|
+
|
|
|
+ self.exportImageView.frame = CGRectMake(self.exportView.bounds.size.width/2-20, 10, 15, 15);
|
|
|
+ self.exportLabel.frame = CGRectMake(self.exportView.bounds.size.width/2 + 5, 8, self.exportView.bounds.size.width/2, 20);
|
|
|
+ self.exportBtn.frame = self.exportView.bounds;
|
|
|
+
|
|
|
+ self.cropView.frame = CGRectMake(CGRectGetMaxX(self.exportView.frame) + 8, CGRectGetMaxY(self.toolsLabel.frame) + 16,(self.bounds.size.width - 16 * 2 - 8*2)/3, 32);
|
|
|
+
|
|
|
+ self.cropImageView.frame = CGRectMake(self.cropView.bounds.size.width/2-20, 10, 15, 15);
|
|
|
+ self.cropLabel.frame = CGRectMake(self.cropView.bounds.size.width/2 + 5, 8, self.cropView.bounds.size.width/2, 20);
|
|
|
+ self.cropBtn.frame = self.cropView.bounds;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|