|
|
@@ -61,7 +61,91 @@
|
|
|
|
|
|
@implementation CommonEditorViewController
|
|
|
|
|
|
+#pragma mark - Code TableView
|
|
|
+- (void)initTableView {
|
|
|
+
|
|
|
+ self.editorTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
|
+ self.editorTable.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
+ [self.view addSubview:self.editorTable];
|
|
|
+ [self.view sendSubviewToBack:self.editorTable];
|
|
|
+
|
|
|
+ NSLayoutConstraint *top_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
+ attribute:NSLayoutAttributeTop
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:self.view
|
|
|
+ attribute:NSLayoutAttributeTop
|
|
|
+ multiplier:1
|
|
|
+ constant:0];
|
|
|
+ self.tb_top_constraint = top_constraint;
|
|
|
+ [self.view addConstraint:top_constraint];
|
|
|
+
|
|
|
+ NSLayoutConstraint *left_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
+ attribute:NSLayoutAttributeLeft
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:self.view
|
|
|
+ attribute:NSLayoutAttributeLeft
|
|
|
+ multiplier:1
|
|
|
+ constant:0];
|
|
|
+ self.tb_left_constraint = left_constraint;
|
|
|
+ [self.view addConstraint:left_constraint];
|
|
|
+
|
|
|
+ NSLayoutConstraint *bottom_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
+ attribute:NSLayoutAttributeBottom
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:self.view
|
|
|
+ attribute:NSLayoutAttributeBottom
|
|
|
+ multiplier:1
|
|
|
+ constant:0];
|
|
|
+ self.tb_bottom_constraint = bottom_constraint;
|
|
|
+ [self.view addConstraint:bottom_constraint];
|
|
|
+
|
|
|
+ NSLayoutConstraint *right_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
+ attribute:NSLayoutAttributeRight
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:self.view
|
|
|
+ attribute:NSLayoutAttributeRight
|
|
|
+ multiplier:1
|
|
|
+ constant:0];
|
|
|
+ self.tb_right_constraint = right_constraint;
|
|
|
+ [self.view addConstraint:right_constraint];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ self.editorTable.delegate = self;
|
|
|
+ self.editorTable.dataSource = self;
|
|
|
+ self.editorTable.tableFooterView = [UIView new];
|
|
|
+ self.editorTable.tableHeaderView = [UIView new];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)registerPhoneCell {
|
|
|
+
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Action_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellAction"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Edit_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellEdit"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Enum_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellEnum"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Image_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellImg"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Label_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellLabel"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_MAction_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellMAction"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Model_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellModel"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Signature_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSignature"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Switch_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSwitch"];
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_TextView_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellTextView"];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setupEditorTable {
|
|
|
+
|
|
|
+ [self initTableView];
|
|
|
+ // Regist Nib Cell
|
|
|
+ NSString *model = [UIDevice currentDevice].model;
|
|
|
+ if ([model isEqualToString:@"iPhone"]) {
|
|
|
+ [self registerPhoneCell];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
+#pragma mark ==============
|
|
|
|
|
|
-(void) commonAction:(NSString *)value index:(NSIndexPath*) indexPath data:(NSMutableDictionary*) item_json
|
|
|
{
|
|
|
@@ -168,6 +252,10 @@
|
|
|
{
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
+ NSString *model = [UIDevice currentDevice].model;
|
|
|
+ if ([model isEqualToString:@"iPhone"]) {
|
|
|
+ [self setupEditorTable];
|
|
|
+ }
|
|
|
|
|
|
// self.switchlock = [[NSLock alloc] init];
|
|
|
|
|
|
@@ -209,7 +297,7 @@
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
NSDictionary* editor_json = [RANetwork request_Editor:weakself.request_url params:weakself.params];
|
|
|
-
|
|
|
+ DebugLog(@"data string: %@",[RAUtils dict2string:editor_json] );
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
[waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
@@ -921,7 +1009,8 @@
|
|
|
}
|
|
|
|
|
|
NSDictionary* editor_json = [RANetwork request_Editor:weakself.request_url params:weakself.params];
|
|
|
-
|
|
|
+ DebugLog(@"data string: %@",[RAUtils dict2string:editor_json] );
|
|
|
+
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
|
|
|
@@ -2564,16 +2653,40 @@
|
|
|
NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
|
|
|
|
|
|
NSString* control = [item_json valueForKey:@"control"];
|
|
|
- if([control isEqualToString:@"model"])
|
|
|
- return 140;
|
|
|
- else if([control isEqualToString:@"signature"])
|
|
|
- return 140;
|
|
|
- else if([control isEqualToString:@"text_view"])
|
|
|
- return 140;
|
|
|
-
|
|
|
- else if([control isEqualToString:@"img"])
|
|
|
- return 123;
|
|
|
- return 44;
|
|
|
+ NSString *model = [UIDevice currentDevice].model;
|
|
|
+ if ([model isEqualToString:@"iPhone"]) {
|
|
|
+ if([control isEqualToString:@"model"])
|
|
|
+ return 140;
|
|
|
+ else if([control isEqualToString:@"signature"])
|
|
|
+ return 200;
|
|
|
+ else if([control isEqualToString:@"text_view"])
|
|
|
+ return 180;
|
|
|
+ else if([control isEqualToString:@"img"])
|
|
|
+ return 240;
|
|
|
+ else if ([control isEqualToString:@"action"])
|
|
|
+ return 44;
|
|
|
+ else if ([control isEqualToString:@"text"])
|
|
|
+ return 80;
|
|
|
+ else if ([control isEqualToString:@"enum"])
|
|
|
+ return 80;
|
|
|
+ else if ([control isEqualToString:@"edit"])
|
|
|
+ return 80;
|
|
|
+ else if ([control isEqualToString:@"switch"])
|
|
|
+ return 80;
|
|
|
+
|
|
|
+ return 80;
|
|
|
+ } else {
|
|
|
+ if([control isEqualToString:@"model"])
|
|
|
+ return 140;
|
|
|
+ else if([control isEqualToString:@"signature"])
|
|
|
+ return 140;
|
|
|
+ else if([control isEqualToString:@"text_view"])
|
|
|
+ return 140;
|
|
|
+
|
|
|
+ else if([control isEqualToString:@"img"])
|
|
|
+ return 123;
|
|
|
+ return 44;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|