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