|
@@ -39,6 +39,8 @@
|
|
|
|
|
|
@property (nonatomic, assign) CPDFPageInsertType pageInsertType;
|
|
|
|
|
|
+@property (nonatomic, strong) NSString *pageType;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation CPDFPageInsertViewController
|
|
@@ -114,6 +116,8 @@
|
|
|
selector:@selector(keyboardWillHide:)
|
|
|
name:UIKeyboardWillHideNotification
|
|
|
object:nil];
|
|
|
+
|
|
|
+ self.pageType = @"A4 (210 X 297mm)";
|
|
|
}
|
|
|
|
|
|
- (void)viewWillLayoutSubviews {
|
|
@@ -135,6 +139,39 @@
|
|
|
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
|
|
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
|
|
[self.tableView reloadData];
|
|
|
+ [self setPageSizeRefresh];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - Private Methods
|
|
|
+
|
|
|
+- (void)setPageSizeRefresh {
|
|
|
+ NSArray *szieArray = @[@"A3 (297 X 420mm)", @"A4 (210 X 297mm)", @"A5 (148 X 210mm)"];
|
|
|
+ if (self.isSelect) {
|
|
|
+ NSIndexPath* path = [NSIndexPath indexPathForRow:0 inSection:0];
|
|
|
+ CInsertBlankPageCell *cell = [self.tableView cellForRowAtIndexPath:path];
|
|
|
+ NSInteger index = [szieArray indexOfObject:self.pageType];
|
|
|
+
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ {
|
|
|
+ NSIndexPath* path = [NSIndexPath indexPathForRow:1 inSection:0];
|
|
|
+ [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ {
|
|
|
+ NSIndexPath* path = [NSIndexPath indexPathForRow:2 inSection:0];
|
|
|
+ [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ NSIndexPath* path = [NSIndexPath indexPathForRow:3 inSection:0];
|
|
|
+ [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#pragma mark - Action
|
|
@@ -168,6 +205,10 @@
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
CInsertBlankPageCell *cell = [[CInsertBlankPageCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"pageCell"];
|
|
|
cell.delegate = self;
|
|
|
+
|
|
|
+ if (self.pageLoactionBtns.count > 3) {
|
|
|
+ [self.pageLoactionBtns removeAllObjects];
|
|
|
+ }
|
|
|
|
|
|
switch (indexPath.row) {
|
|
|
case 0:
|
|
@@ -341,6 +382,7 @@
|
|
|
if (self.isSelect) {
|
|
|
self.pageModel.size = CGSizeMake(297, 420);
|
|
|
cell.sizeLabel.text = @"A3 (297 X 420mm)";
|
|
|
+ self.pageType = @"A3 (297 X 420mm)";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -349,6 +391,7 @@
|
|
|
if (self.isSelect) {
|
|
|
self.pageModel.size = CGSizeMake(210, 297);
|
|
|
cell.sizeLabel.text = @"A4 (210 X 297mm)";
|
|
|
+ self.pageType = @"A4 (210 X 297mm)";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -357,6 +400,7 @@
|
|
|
if (self.isSelect) {
|
|
|
self.pageModel.size = CGSizeMake(148, 210);
|
|
|
cell.sizeLabel.text = @"A5 (148 X 210mm)";
|
|
|
+ self.pageType = @"A5 (148 X 210mm)";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -375,8 +419,6 @@
|
|
|
|
|
|
if (isSelect) {
|
|
|
NSInteger t = indexPath.row;
|
|
|
- NSLog(@"t is %zd",t);
|
|
|
- NSMutableArray *array = [NSMutableArray array];
|
|
|
NSMutableArray *data = [NSMutableArray arrayWithArray:self.dataArray];
|
|
|
for (NSString *str in szieArray) {
|
|
|
t++;
|
|
@@ -389,9 +431,10 @@
|
|
|
}
|
|
|
self.dataArray = (NSArray *)data;
|
|
|
|
|
|
+ [self.tableView reloadData];
|
|
|
+ [self setPageSizeRefresh];
|
|
|
} else {
|
|
|
NSInteger t = indexPath.row;
|
|
|
- NSMutableArray *array = [NSMutableArray array];
|
|
|
NSMutableArray *data = [NSMutableArray arrayWithArray:self.dataArray];
|
|
|
for (int i = 0; i < szieArray.count; i++) {
|
|
|
t++;
|
|
@@ -401,11 +444,13 @@
|
|
|
}
|
|
|
}
|
|
|
self.dataArray = (NSArray *)data;
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
|
|
|
- NSLog(@"dataArray %@",self.dataArray);
|
|
|
-
|
|
|
- [self.tableView reloadData];
|
|
|
+ NSIndexPath* path = [NSIndexPath indexPathForRow:0 inSection:0];
|
|
|
+ CInsertBlankPageCell *cell = [self.tableView cellForRowAtIndexPath:path];
|
|
|
+ cell.sizeLabel.text = self.pageType;
|
|
|
}
|
|
|
|
|
|
- (void)insertBlankPageCellLocation:(CInsertBlankPageCell *)insertBlankPageCell button:(nonnull UIButton *)buttom {
|