|
@@ -67,6 +67,8 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
|
|
|
|
|
|
@property (nonatomic, strong) UIView *modelView;
|
|
|
|
|
|
+@property (nonatomic, strong) UIView *headerView;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation CPDFStampViewController
|
|
@@ -76,7 +78,13 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
|
- self.view.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
|
|
|
+ self.view.backgroundColor = [CPDFColorUtils CAnnotationSampleBackgoundColor];
|
|
|
+
|
|
|
+ self.headerView = [[UIView alloc] init];
|
|
|
+ self.headerView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
|
|
|
+ self.headerView.layer.borderWidth = 1.0;
|
|
|
+ self.headerView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
|
|
|
+ [self.view addSubview:self.headerView];
|
|
|
|
|
|
self.titleLabel = [[UILabel alloc] init];
|
|
|
self.titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
|
|
@@ -84,13 +92,13 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
|
|
|
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.titleLabel.font = [UIFont systemFontOfSize:20];
|
|
|
self.titleLabel.adjustsFontSizeToFitWidth = YES;
|
|
|
- [self.view addSubview:self.titleLabel];
|
|
|
+ [self.headerView addSubview:self.titleLabel];
|
|
|
|
|
|
self.backBtn = [[UIButton alloc] init];
|
|
|
self.backBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
|
|
[self.backBtn setImage:[UIImage imageNamed:@"CPDFAnnotationBaseImageBack" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
|
|
|
[self.backBtn addTarget:self action:@selector(buttonItemClicked_back:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [self.view addSubview:self.backBtn];
|
|
|
+ [self.headerView addSubview:self.backBtn];
|
|
|
|
|
|
NSArray *segmmentArray = [NSArray arrayWithObjects:NSLocalizedString(@"Standard", nil), NSLocalizedString(@"Customize", nil), nil];
|
|
|
self.segmentedControl = [[UISegmentedControl alloc] initWithItems:segmmentArray];
|
|
@@ -131,8 +139,9 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
|
|
|
|
|
|
- (void)viewWillLayoutSubviews {
|
|
|
[super viewWillLayoutSubviews];
|
|
|
- self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 5, 120, 50);
|
|
|
- self.segmentedControl.frame = CGRectMake(50, 50, self.view.frame.size.width-100, 30);
|
|
|
+ self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 0, 120, 50);
|
|
|
+ self.segmentedControl.frame = CGRectMake(50, 55, self.view.frame.size.width-100, 30);
|
|
|
+ self.headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, 50);
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 50);
|
|
|
self.createButton.frame = CGRectMake(self.view.frame.size.width - 70 - self.view.safeAreaInsets.right, self.view.bounds.size.height - 200 - self.view.safeAreaInsets.bottom, 50, 50);
|
|
@@ -581,15 +590,27 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
|
|
|
#pragma mark - CCustomizeStampTableViewCellDelegate
|
|
|
|
|
|
- (void)customizeStampTableViewCell:(CCustomizeStampTableViewCell *)customizeStampTableViewCell {
|
|
|
- NSIndexPath *select = [self.tableView indexPathForCell:customizeStampTableViewCell];
|
|
|
-
|
|
|
- if (select.section == 0) {
|
|
|
- [self.stampFileManager removeStampItem:select.row type:PDFStampCustomType_Text];
|
|
|
- } else if (select.section == 1) {
|
|
|
- [self.stampFileManager removeStampItem:select.row type:PDFStampCustomType_Image];
|
|
|
- }
|
|
|
-
|
|
|
- [self.tableView reloadData];
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
|
|
|
+ style:UIAlertActionStyleCancel
|
|
|
+ handler:nil];
|
|
|
+ UIAlertAction *OKAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Sure", nil)
|
|
|
+ style:UIAlertActionStyleDefault
|
|
|
+ handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ NSIndexPath *select = [self.tableView indexPathForCell:customizeStampTableViewCell];
|
|
|
+ if (select.section == 0) {
|
|
|
+ [self.stampFileManager removeStampItem:select.row type:PDFStampCustomType_Text];
|
|
|
+ } else if (select.section == 1) {
|
|
|
+ [self.stampFileManager removeStampItem:select.row type:PDFStampCustomType_Image];
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
+ }];
|
|
|
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Tip", nil)
|
|
|
+ message:NSLocalizedString(@"Are you sure you want to delete the stamp?", nil)
|
|
|
+ preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ [alert addAction:cancelAction];
|
|
|
+ [alert addAction:OKAction];
|
|
|
+ [self presentViewController:alert animated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
#pragma mark - CStampTextViewControllerDelegate
|