|
@@ -24,6 +24,7 @@
|
|
|
|
|
|
|
|
#import "RAUtils.h"
|
|
#import "RAUtils.h"
|
|
|
#import "AppDelegate.h"
|
|
#import "AppDelegate.h"
|
|
|
|
|
+#import "TouchLabel.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
typedef enum {
|
|
@@ -495,6 +496,65 @@ typedef enum {
|
|
|
}
|
|
}
|
|
|
return nil;
|
|
return nil;
|
|
|
|
|
|
|
|
|
|
+}
|
|
|
|
|
+-(void) addTouchLabel:(NSMutableDictionary*) template destView:(UIView*)destView index:(int) index update:(BOOL)update
|
|
|
|
|
+{
|
|
|
|
|
+CGRect srect=[self scaleControl:CGRectMake([template[@"pos_x"] floatValue], [template[@"pos_y"] floatValue], [template[@"width"] floatValue], [template[@"height"] floatValue]) from:CGSizeMake(768, 960) to:destView.frame.size];
|
|
|
|
|
+ TouchLabel* label = (TouchLabel *)[destView viewWithTag:index+ CONTROL_BASE];
|
|
|
|
|
+if (label) {
|
|
|
|
|
+ label.frame = srect;
|
|
|
|
|
+} else {
|
|
|
|
|
+ label = [[TouchLabel alloc] initWithFrame:srect];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+float fontsize = [template[@"size"] floatValue];
|
|
|
|
|
+if(fontsize==0)
|
|
|
|
|
+fontsize=10;
|
|
|
|
|
+[label setFont:[UIFont systemFontOfSize:fontsize]];
|
|
|
|
|
+
|
|
|
|
|
+NSString * alignment=template[@"textAlignment"];
|
|
|
|
|
+
|
|
|
|
|
+if([alignment.lowercaseString isEqualToString:@"center"])
|
|
|
|
|
+label.textAlignment=NSTextAlignmentCenter;
|
|
|
|
|
+else if([alignment.lowercaseString isEqualToString:@"left"])
|
|
|
|
|
+label.textAlignment=NSTextAlignmentLeft;
|
|
|
|
|
+else if([alignment.lowercaseString isEqualToString:@"right"])
|
|
|
|
|
+label.textAlignment=NSTextAlignmentRight;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+if (!update) {
|
|
|
|
|
+ label.text =template[@"value"];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+label.tag = index+ CONTROL_BASE;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//UIColorFromARGB(0x4066ccff);
|
|
|
|
|
+
|
|
|
|
|
+// tv.backgroundColor = UIColorFromRGB(TV_BG);//[UIColor lightGrayColor];
|
|
|
|
|
+// tv.place
|
|
|
|
|
+// [btn setTitle:template[@"title"] forState:UIControlStateNormal];
|
|
|
|
|
+// ref addTarget:self action:@selector(manually_refresh) forControlEvents:UIControlEventValueChanged
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// tv.delegate = self;
|
|
|
|
|
+// [btn addTarget:self action:@selector(ControlButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
+if(DEBUG_PDFSIG)
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+ if (!update) {
|
|
|
|
|
+ [label setBackgroundColor:[UIColor grayColor]];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+if (!update) {
|
|
|
|
|
+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
|
|
|
|
|
+ [label addGestureRecognizer:tap];
|
|
|
|
|
+ label.userInteractionEnabled = YES;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+[destView addSubview:label];
|
|
|
}
|
|
}
|
|
|
-(void) addTextView:(NSMutableDictionary*) template destView:(UIView*)destView index:(int) index update:(BOOL)update
|
|
-(void) addTextView:(NSMutableDictionary*) template destView:(UIView*)destView index:(int) index update:(BOOL)update
|
|
|
{
|
|
{
|
|
@@ -2462,6 +2522,10 @@ typedef enum {
|
|
|
[self addDatePicker:[control mutableCopy] destView:self.editControlView index:(int)count update:NO];
|
|
[self addDatePicker:[control mutableCopy] destView:self.editControlView index:(int)count update:NO];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ else if([control[@"type"] isEqualToString:@"TouchLabel"])
|
|
|
|
|
+ {
|
|
|
|
|
+ [self addTouchLabel:[control mutableCopy] destView:self.editControlView index:(int)count update:NO];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 更新数据
|
|
// 更新数据
|
|
|
NSString *key = [NSString stringWithFormat:@"control_%ld",count];
|
|
NSString *key = [NSString stringWithFormat:@"control_%ld",count];
|
|
@@ -2523,7 +2587,21 @@ typedef enum {
|
|
|
// 刷新视图
|
|
// 刷新视图
|
|
|
[self viewWillLayoutSubviews];
|
|
[self viewWillLayoutSubviews];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+- (NSInteger)addListItem:(NSDictionary *)item ForSection:(NSInteger)section {
|
|
|
|
|
+ NSString *control_key = [NSString stringWithFormat:@"control_%ld",section];
|
|
|
|
|
+ NSMutableDictionary *control = [[self.page_controlTemplate objectForKey:control_key] mutableCopy];
|
|
|
|
|
+ NSMutableDictionary *cadedate = [[control objectForKey:@"cadedate"] mutableCopy];
|
|
|
|
|
+ int count = [cadedate[@"count"] intValue];
|
|
|
|
|
+ cadedate[[NSString stringWithFormat:@"val_%d",count] ]=item;
|
|
|
|
|
+ count++;
|
|
|
|
|
+ cadedate[@"count"]=[NSNumber numberWithInt:count];
|
|
|
|
|
+
|
|
|
|
|
+ [control setObject:cadedate forKey:@"cadedate"];
|
|
|
|
|
+ [self.page_controlTemplate setObject:control forKey:control_key];
|
|
|
|
|
+
|
|
|
|
|
+ NSInteger tag = CHECK_BASE+section*1000+(count-1);
|
|
|
|
|
+ return tag;
|
|
|
|
|
+}
|
|
|
- (NSInteger)addCheckOption:(NSArray *)option ForSection:(NSInteger)section {
|
|
- (NSInteger)addCheckOption:(NSArray *)option ForSection:(NSInteger)section {
|
|
|
NSString *control_key = [NSString stringWithFormat:@"control_%ld",section];
|
|
NSString *control_key = [NSString stringWithFormat:@"control_%ld",section];
|
|
|
NSMutableDictionary *control = [[self.page_controlTemplate objectForKey:control_key] mutableCopy];
|
|
NSMutableDictionary *control = [[self.page_controlTemplate objectForKey:control_key] mutableCopy];
|