|
@@ -65,7 +65,6 @@
|
|
self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 550);
|
|
self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 550);
|
|
|
|
|
|
if (@available(iOS 11.0, *)) {
|
|
if (@available(iOS 11.0, *)) {
|
|
- self.colorPicker.frame = CGRectMake(self.view.safeAreaInsets.left, 0, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height);
|
|
|
|
self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, 0,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, 0,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.fillColorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 90, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.fillColorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 90, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 180, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 180, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
@@ -73,12 +72,11 @@
|
|
self.dottedView.frame = CGRectMake(self.view.safeAreaInsets.left, 360, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.dottedView.frame = CGRectMake(self.view.safeAreaInsets.left, 360, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
|
|
self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 50);
|
|
self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 50);
|
|
} else {
|
|
} else {
|
|
- self.colorPicker.frame = self.view.frame;
|
|
|
|
- self.colorView.frame = CGRectMake(0, 120, self.view.frame.size.width, 90);
|
|
|
|
- self.opacitySliderView.frame = CGRectMake(0, 300, self.view.frame.size.width, 90);
|
|
|
|
- self.fillColorSelectView.frame = CGRectMake(0, 210, self.view.frame.size.width, 90);
|
|
|
|
- self.thicknessView.frame = CGRectMake(0, 390, self.view.frame.size.width, 90);
|
|
|
|
- self.dottedView.frame = CGRectMake(0, 470, self.view.frame.size.width, 90);
|
|
|
|
|
|
+ self.colorView.frame = CGRectMake(0, 0, self.view.frame.size.width, 90);
|
|
|
|
+ self.opacitySliderView.frame = CGRectMake(0, 180, self.view.frame.size.width, 90);
|
|
|
|
+ self.fillColorSelectView.frame = CGRectMake(0, 90, self.view.frame.size.width, 90);
|
|
|
|
+ self.thicknessView.frame = CGRectMake(0, 270, self.view.frame.size.width, 90);
|
|
|
|
+ self.dottedView.frame = CGRectMake(0, 360, self.view.frame.size.width, 90);
|
|
self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 50);
|
|
self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 50);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -116,7 +114,7 @@
|
|
break;
|
|
break;
|
|
case CPDFViewAnnotationModeSquare:
|
|
case CPDFViewAnnotationModeSquare:
|
|
{
|
|
{
|
|
- self.titleLabel.text = NSLocalizedString(@"Rectangle", nil);
|
|
|
|
|
|
+ self.titleLabel.text = NSLocalizedString(@"Square", nil);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case CPDFViewAnnotationModeArrow:
|
|
case CPDFViewAnnotationModeArrow:
|
|
@@ -143,7 +141,19 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
|
|
- (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
|
|
- self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 660);
|
|
|
|
|
|
+ if ([self.colorPicker superview] || [self.fillColorPicker superview]) {
|
|
|
|
+ UIDevice *currentDevice = [UIDevice currentDevice];
|
|
|
|
+ if (currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
|
|
|
+ // This is an iPad
|
|
|
|
+ self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, 520);
|
|
|
|
+ } else {
|
|
|
|
+ // This is an iPhone or iPod touch
|
|
|
|
+ self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, 320);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 660);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- (void)updateBordColor:(UIColor *)color {
|
|
- (void)updateBordColor:(UIColor *)color {
|
|
@@ -242,11 +252,19 @@
|
|
self.picker.delegate = self;
|
|
self.picker.delegate = self;
|
|
[self presentViewController:self.picker animated:YES completion:nil];
|
|
[self presentViewController:self.picker animated:YES completion:nil];
|
|
} else {
|
|
} else {
|
|
- self.colorPicker = [[CPDFColorPickerView alloc] initWithFrame:self.view.frame];
|
|
|
|
|
|
+ UIDevice *currentDevice = [UIDevice currentDevice];
|
|
|
|
+ if (currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
|
|
|
+ // This is an iPad
|
|
|
|
+ self.colorPicker = [[CPDFColorPickerView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, 520)];
|
|
|
|
+ } else {
|
|
|
|
+ // This is an iPhone or iPod touch
|
|
|
|
+ self.colorPicker = [[CPDFColorPickerView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, 320)];
|
|
|
|
+ }
|
|
self.colorPicker.delegate = self;
|
|
self.colorPicker.delegate = self;
|
|
- self.colorPicker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
self.colorPicker.backgroundColor = [UIColor whiteColor];
|
|
self.colorPicker.backgroundColor = [UIColor whiteColor];
|
|
[self.view addSubview:self.colorPicker];
|
|
[self.view addSubview:self.colorPicker];
|
|
|
|
+
|
|
|
|
+ [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
|
|
}
|
|
}
|
|
} else if (select == self.fillColorSelectView) {
|
|
} else if (select == self.fillColorSelectView) {
|
|
if (@available(iOS 14.0, *)) {
|
|
if (@available(iOS 14.0, *)) {
|
|
@@ -254,11 +272,19 @@
|
|
self.fillPicker.delegate = self;
|
|
self.fillPicker.delegate = self;
|
|
[self presentViewController:self.fillPicker animated:YES completion:nil];
|
|
[self presentViewController:self.fillPicker animated:YES completion:nil];
|
|
} else {
|
|
} else {
|
|
- self.fillColorPicker = [[CPDFColorPickerView alloc] initWithFrame:self.view.frame];
|
|
|
|
|
|
+ UIDevice *currentDevice = [UIDevice currentDevice];
|
|
|
|
+ if (currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
|
|
|
+ // This is an iPad
|
|
|
|
+ self.fillColorPicker = [[CPDFColorPickerView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, 520)];
|
|
|
|
+ } else {
|
|
|
|
+ // This is an iPhone or iPod touch
|
|
|
|
+ self.fillColorPicker = [[CPDFColorPickerView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, 320)];
|
|
|
|
+ }
|
|
self.fillColorPicker.delegate = self;
|
|
self.fillColorPicker.delegate = self;
|
|
- self.fillColorPicker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
self.fillColorPicker.backgroundColor = [UIColor whiteColor];
|
|
self.fillColorPicker.backgroundColor = [UIColor whiteColor];
|
|
[self.view addSubview:self.fillColorPicker];
|
|
[self.view addSubview:self.fillColorPicker];
|
|
|
|
+
|
|
|
|
+ [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -284,6 +310,8 @@
|
|
[color getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
[color getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
self.opacitySliderView.opacitySlider.value = alpha;
|
|
self.opacitySliderView.opacitySlider.value = alpha;
|
|
self.opacitySliderView.startLabel.text = [NSString stringWithFormat:@"%d%%", (int)((self.opacitySliderView.opacitySlider.value/1)*100)];
|
|
self.opacitySliderView.startLabel.text = [NSString stringWithFormat:@"%d%%", (int)((self.opacitySliderView.opacitySlider.value/1)*100)];
|
|
|
|
+
|
|
|
|
+ [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark - UIColorPickerViewControllerDelegate
|
|
#pragma mark - UIColorPickerViewControllerDelegate
|