|
|
@@ -22,6 +22,8 @@
|
|
|
|
|
|
#import "RAUtils.h"
|
|
|
#import "AppDelegate.h"
|
|
|
+#import "TouchLabel.h"
|
|
|
+#import "EnumSelectViewController.h"
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
@@ -309,6 +311,10 @@ typedef enum {
|
|
|
{
|
|
|
[self addTextView:control destView:self.editControlView index:i];
|
|
|
}
|
|
|
+ if([control[@"type"] isEqualToString:@"TouchLabel"])
|
|
|
+ {
|
|
|
+ [self addTouchLabel:control destView:self.editControlView index:i];
|
|
|
+ }
|
|
|
else if([control[@"type"] isEqualToString:@"Button"])
|
|
|
{
|
|
|
[self addButton:control destView:self.editControlView index:i];
|
|
|
@@ -624,6 +630,52 @@ typedef enum {
|
|
|
|
|
|
|
|
|
|
|
|
+ //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)
|
|
|
+ {
|
|
|
+
|
|
|
+ [label setBackgroundColor:[UIColor grayColor]];
|
|
|
+
|
|
|
+ }
|
|
|
+ [destView addSubview:label];
|
|
|
+}
|
|
|
+-(void) addTouchLabel:(NSMutableDictionary*) template destView:(UIView*)destView index:(int) index
|
|
|
+{
|
|
|
+ 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 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;
|
|
|
+ label.backgroundColor = UIColorFromRGB(TV_BG);//[UIColor lightGrayColor];
|
|
|
+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LabelTap:)];
|
|
|
+ // tap.minimumPressDuration = 0.8; //定义按的时间
|
|
|
+ [label addGestureRecognizer:tap];
|
|
|
+
|
|
|
+ label.text =template[@"value"];
|
|
|
+
|
|
|
+ label.tag = index+ CONTROL_BASE;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//UIColorFromARGB(0x4066ccff);
|
|
|
|
|
|
// tv.backgroundColor = UIColorFromRGB(TV_BG);//[UIColor lightGrayColor];
|
|
|
@@ -643,6 +695,119 @@ typedef enum {
|
|
|
[destView addSubview:label];
|
|
|
}
|
|
|
|
|
|
+-(void)LabelTap:(UILongPressGestureRecognizer*)gestureRecognizer {
|
|
|
+
|
|
|
+ long index = gestureRecognizer.view.tag - CONTROL_BASE;
|
|
|
+
|
|
|
+
|
|
|
+ DebugLog(@"LabelTap tag = %ld",index);
|
|
|
+
|
|
|
+ NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSString* action = control_json[@"action"];
|
|
|
+ if ([action isEqualToString:@"enum"])
|
|
|
+ {
|
|
|
+ NSMutableDictionary* cadedate = control_json[@"cadedate"];
|
|
|
+
|
|
|
+
|
|
|
+ EnumSelectViewController* enumvc =[[UIStoryboard storyboardWithName:@"CommonEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
|
|
|
+
|
|
|
+ enumvc.max_select = 1;
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.cadedate = cadedate;
|
|
|
+ enumvc.title = @"";
|
|
|
+
|
|
|
+
|
|
|
+ enumvc.single_select =true;
|
|
|
+
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+
|
|
|
+ enumvc.returnValue = ^(NSMutableDictionary* value){
|
|
|
+ control_json[@"cadedate"]=value;
|
|
|
+ int count = [[value valueForKey:@"count"] intValue];
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+ NSDictionary* val_json =[value objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
+ if(check==1)
|
|
|
+ {
|
|
|
+ TouchLabel* label = (TouchLabel*)gestureRecognizer.view;
|
|
|
+ label.text = [val_json valueForKey:@"value"];
|
|
|
+ control_json[@"value"]= [val_json valueForKey:@"value"];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// if (weakSelf) {
|
|
|
+// __strong typeof(weakSelf) strongSelf = weakSelf;
|
|
|
+// [strongSelf changePriceType:[strongSelf checkedCadedate:value]];
|
|
|
+// }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ [self presentViewController:enumvc animated:true completion:nil];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // if(gestureRecognizer.view.tag - self.basetag < MAX_COLUMN) //header
|
|
|
+ // return;
|
|
|
+
|
|
|
+// [UIView beginAnimations:nil context:nil];
|
|
|
+// [UIView setAnimationDuration:0.65];
|
|
|
+// long row = gestureRecognizer.view.tag/self.column_count;
|
|
|
+// long column = gestureRecognizer.view.tag%self.column_count;
|
|
|
+// if(self.fullrowselect)
|
|
|
+// {
|
|
|
+//
|
|
|
+// for(int i=0;i<self.column_count;i++)
|
|
|
+// {
|
|
|
+// [self viewWithTag:(row*self.column_count+i)].alpha = 0.5;
|
|
|
+// }
|
|
|
+// for(int i=0;i<self.column_count;i++)
|
|
|
+// {
|
|
|
+// [self viewWithTag:(row*self.column_count+i)].alpha = 1.0;
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// gestureRecognizer.view.alpha=0.5;
|
|
|
+// gestureRecognizer.view.alpha=1;
|
|
|
+//
|
|
|
+// }
|
|
|
+// [UIView commitAnimations];
|
|
|
+//
|
|
|
+//
|
|
|
+// if(self.fullrowselect)
|
|
|
+// {
|
|
|
+// if (self.griddelegate && [self.griddelegate respondsToSelector:@selector(Tap:row:)])
|
|
|
+// [griddelegate Tap:gestureRecognizer.view row:row];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// if (self.griddelegate && [self.griddelegate respondsToSelector:@selector(Tap:row:column:)])
|
|
|
+// [griddelegate Tap:gestureRecognizer.view row:row column:column];
|
|
|
+
|
|
|
+ // TouchLabel* label = (TouchLabel*)gestureRecognizer.view;
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // NSString * url =[self.hrefs valueForKey:label.text];
|
|
|
+ // if(url!=nil)
|
|
|
+ // {
|
|
|
+ // label.textColor = [UIColor purpleColor];
|
|
|
+ // [griddelegate Tap:label url:url];//first row is header;
|
|
|
+ // }
|
|
|
+
|
|
|
+}
|
|
|
-(void) addButton:(NSMutableDictionary*) template destView:(UIView*)destView index:(int) index
|
|
|
{
|
|
|
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];
|