|
@@ -47,6 +47,7 @@
|
|
|
#import "RAConvertor.h"
|
|
#import "RAConvertor.h"
|
|
|
#import "EnumSelectAndSortViewController.h"
|
|
#import "EnumSelectAndSortViewController.h"
|
|
|
#import "CommonEditorRangeCell.h"
|
|
#import "CommonEditorRangeCell.h"
|
|
|
|
|
+#import "CommonEditorWebCell.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -56,7 +57,7 @@
|
|
|
|
|
|
|
|
@implementation subitem_data
|
|
@implementation subitem_data
|
|
|
@end
|
|
@end
|
|
|
-@interface CommonEditorViewController ()<CommonEditorRangeDelegate>
|
|
|
|
|
|
|
+@interface CommonEditorViewController ()<CommonEditorRangeDelegate,CommonEditorWebCellDelegate>
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
@@ -132,6 +133,7 @@
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Switch_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSwitch"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Switch_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSwitch"];
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_TextView_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellTextView"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_TextView_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellTextView"];
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Range_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorRangeCell"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Range_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorRangeCell"];
|
|
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Web_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorWebCell"];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)setupEditorTable {
|
|
- (void)setupEditorTable {
|
|
@@ -2700,6 +2702,11 @@
|
|
|
return 100;
|
|
return 100;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ else if ([control isEqualToString:@"webview"]) {
|
|
|
|
|
+ id h_obj = [item_json objectForKey:@"height"];
|
|
|
|
|
+ CGFloat height = [h_obj floatValue];
|
|
|
|
|
+ return height;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 80;
|
|
return 80;
|
|
|
} else {
|
|
} else {
|
|
@@ -3985,6 +3992,16 @@
|
|
|
}
|
|
}
|
|
|
return cell;
|
|
return cell;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if ([control isEqualToString:@"webview"]) {
|
|
|
|
|
+
|
|
|
|
|
+ CommonEditorWebCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CommonEditorWebCell" forIndexPath:indexPath];
|
|
|
|
|
+ cell.webDelegate = self;
|
|
|
|
|
+ NSString *html_str = [item_json objectForKey:@"value"];
|
|
|
|
|
+ [cell.webview loadHTMLString:html_str baseURL:nil];
|
|
|
|
|
+// [cell.webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.baidu.com/"]]];
|
|
|
|
|
+
|
|
|
|
|
+ return cell;
|
|
|
|
|
+ }
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
CellIdentifier = @"CommonEditorCellEdit";
|
|
CellIdentifier = @"CommonEditorCellEdit";
|
|
@@ -5933,6 +5950,36 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#pragma mark - WebCell Delegate
|
|
|
|
|
+
|
|
|
|
|
+- (void)commonEditorWebCell:(CommonEditorWebCell *)cell didChangeContentHeight:(CGFloat)contentHeight {
|
|
|
|
|
+ NSIndexPath *indexPath = [self.editorTable indexPathForCell:cell];
|
|
|
|
|
+ if (indexPath == nil) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
|
|
|
|
|
+ NSString* control = [item_json valueForKey:@"control"];
|
|
|
|
|
+ id height_obj = [item_json objectForKey:@"height"];
|
|
|
|
|
+ if ([control isEqualToString:@"webview"] && height_obj == nil) {
|
|
|
|
|
+ // 更新数据
|
|
|
|
|
+ [item_json setObject:@(contentHeight) forKey:@"height"];
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary *section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
|
|
+ [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
|
|
+ [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
|
|
+ self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
|
|
|
|
|
+
|
|
|
|
|
+// // 调用 tableView 的 beginUpdates 和 endUpdates,更新 cell 的高度
|
|
|
|
|
+// [self.editorTable beginUpdates];
|
|
|
|
|
+// [self.editorTable endUpdates];
|
|
|
|
|
+
|
|
|
|
|
+// [self.editorTable reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
|
|
|