|
@@ -15,6 +15,7 @@
|
|
|
#import "TabBarController.h"
|
|
#import "TabBarController.h"
|
|
|
#import "DetailCellTracking.h"
|
|
#import "DetailCellTracking.h"
|
|
|
#import <QuickLook/QuickLook.h>
|
|
#import <QuickLook/QuickLook.h>
|
|
|
|
|
+#import "DetailCellKVNew.h"
|
|
|
|
|
|
|
|
@interface DetailPageViewController () <QLPreviewControllerDataSource,QLPreviewControllerDelegate>
|
|
@interface DetailPageViewController () <QLPreviewControllerDataSource,QLPreviewControllerDelegate>
|
|
|
|
|
|
|
@@ -773,118 +774,138 @@
|
|
|
}
|
|
}
|
|
|
else if([type isEqualToString:@"mapping"])
|
|
else if([type isEqualToString:@"mapping"])
|
|
|
{
|
|
{
|
|
|
- float width = tableView.frame.size.width;
|
|
|
|
|
|
|
|
|
|
- width-=CELL_MARGIN*2;
|
|
|
|
|
- CGSize constraintkey = CGSizeMake(width*0.4-2*LABEL_MARGIN, 20000.0f);//key label width is 40% cell width;
|
|
|
|
|
- CGSize constraintval = CGSizeMake(width*0.6-2*LABEL_MARGIN, 20000.0f);//val label width is 60% cell width;
|
|
|
|
|
|
|
+ NSString *CellIdentifier = @"detail_item_kvnew";
|
|
|
|
|
+ DetailCellKVNew *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
NSDictionary* item = [self.content get_item_seg:indexPath.section row:indexPath.row];
|
|
NSDictionary* item = [self.content get_item_seg:indexPath.section row:indexPath.row];
|
|
|
- NSString* key =[item allKeys][0];
|
|
|
|
|
- // [cell.keyLabel sizeToFit];
|
|
|
|
|
- NSString* val=[item valueForKey:key];
|
|
|
|
|
- if([val isEqual:[NSNull null]])
|
|
|
|
|
- val=@"";
|
|
|
|
|
- if(val==nil)
|
|
|
|
|
- val=@"";
|
|
|
|
|
- if([val isEqualToString:@"null"])
|
|
|
|
|
- val=@"";
|
|
|
|
|
|
|
+ NSString* key =[item allKeys][0];
|
|
|
|
|
+ // [cell.keyLabel sizeToFit];
|
|
|
|
|
+ NSString* val=[item valueForKey:key];
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ cell.keyLabel.text = key;
|
|
|
|
|
+ cell.valLabel.htmlText = val;
|
|
|
|
|
|
|
|
|
|
+ NSLog(@"key %@ val %@",key,val);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- CGRect frame;
|
|
|
|
|
- frame.size = constraintval;
|
|
|
|
|
- frame.origin.x=0;
|
|
|
|
|
- frame.origin.y=0;
|
|
|
|
|
- RTLabel* rtlabel = [[RTLabel alloc] initWithFrame:frame];
|
|
|
|
|
- [rtlabel setLineBreakMode: RTTextLineBreakModeWordWrapping];
|
|
|
|
|
- // rtlabel.lineSpacing = 20.0;
|
|
|
|
|
- [rtlabel setText: val];
|
|
|
|
|
- CGSize sizeval=rtlabel.optimumSize;
|
|
|
|
|
- CGSize sizekey = [key sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
- // CGSize sizeval = [val sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:constraintval lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
-// DebugLog(@"tableView width:%f",width);
|
|
|
|
|
-//
|
|
|
|
|
-// DebugLog(@"key width= %f val width = %f",constraintkey.width,constraintval.width);
|
|
|
|
|
-// DebugLog(@"key = %@ val = %@",key,val);
|
|
|
|
|
- float height = MAX(sizekey.height,sizeval.height);
|
|
|
|
|
- height = MAX(height, DEF_CELL_HEIGHT-LINE_WIDTH);
|
|
|
|
|
- sizekey.height = height;
|
|
|
|
|
- sizekey.width = constraintkey.width;
|
|
|
|
|
- // sizeval.height = height;
|
|
|
|
|
- sizeval.width =constraintval.width;
|
|
|
|
|
-
|
|
|
|
|
- NSString *CellIdentifier = @"detail_item_kv";
|
|
|
|
|
- DetailCellKV *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
|
|
- if(cell==nil)
|
|
|
|
|
- DebugLog(@"cell is nil.........................");
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // CGRect framekey ;
|
|
|
|
|
- // framekey.origin.x=CELL_MARGIN;
|
|
|
|
|
- // framekey.origin.y=LINE_WIDTH;
|
|
|
|
|
- // framekey.size = sizekey;
|
|
|
|
|
- // UILabel* keyLabel = [[UILabel alloc]initWithFrame:framekey];
|
|
|
|
|
- // keyLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
|
- // keyLabel.backgroundColor = [UIColor grayColor];
|
|
|
|
|
- // keyLabel.text = key;
|
|
|
|
|
- //
|
|
|
|
|
- // CGRect frameval;
|
|
|
|
|
- // frameval.origin.x=constraintkey.width+CELL_MARGIN;
|
|
|
|
|
- // frameval.origin.y=LINE_WIDTH;
|
|
|
|
|
- // frameval.size = sizeval;
|
|
|
|
|
- //
|
|
|
|
|
- // UILabel* valLabel = [[UILabel alloc]initWithFrame:frameval];
|
|
|
|
|
- // valLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
|
- // valLabel.text = val;
|
|
|
|
|
- //
|
|
|
|
|
- // for(UIView* v in cell.contentView.subviews)
|
|
|
|
|
- // {
|
|
|
|
|
- // [v removeFromSuperview];
|
|
|
|
|
- //
|
|
|
|
|
- // }
|
|
|
|
|
- //
|
|
|
|
|
- // [cell.contentView addSubview:keyLabel];
|
|
|
|
|
- // [cell.contentView addSubview:valLabel];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- CGRect framekey = cell.keyLabel.frame;
|
|
|
|
|
- framekey.origin.x=CELL_MARGIN+LABEL_MARGIN;
|
|
|
|
|
- framekey.origin.y=LINE_WIDTH;
|
|
|
|
|
- framekey.size = sizekey;
|
|
|
|
|
- cell.keyLabel.frame = framekey;
|
|
|
|
|
- cell.keyLabel.text=key;
|
|
|
|
|
- CGRect frameval = cell.valLabel.frame;
|
|
|
|
|
- frameval.origin.x=constraintkey.width+CELL_MARGIN+3*LABEL_MARGIN; //2 margin for key 1 margin for value self
|
|
|
|
|
- frameval.origin.y=LINE_WIDTH;
|
|
|
|
|
- frameval.size = sizeval;
|
|
|
|
|
- cell.valLabel.frame = frameval;
|
|
|
|
|
- // [cell.valLabel setTextAlignment:RTTextAlignmentCenter];
|
|
|
|
|
- cell.valLabel.text= val;
|
|
|
|
|
- CGPoint rcenter;
|
|
|
|
|
- rcenter.x = width * 0.4+width * 0.6/2;
|
|
|
|
|
- rcenter.y = height /2;
|
|
|
|
|
- cell.valLabel.center=rcenter;
|
|
|
|
|
-// cell.valLabel.backgroundColor =[UIColor redColor];
|
|
|
|
|
-
|
|
|
|
|
-// cell.contentView.superview.backgroundColor = [UIColor clearColor];
|
|
|
|
|
-// cell.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
- UIView * lineview = [[LineView alloc] initWithFrame:cell.contentView.frame];
|
|
|
|
|
- lineview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件
|
|
|
|
|
- lineview.backgroundColor = [UIColor clearColor];// 设为透明从而使得cell.backgroundColor有效.
|
|
|
|
|
- lineview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
|
- [cell.contentView addSubview:lineview];// cell.contentView是个readonly属性,所以别想着替换contentView了.
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // [cell.valLabel sizeToFit];
|
|
|
|
|
- // cell.anameLabel.text = [field valueForKey:@"aname"];
|
|
|
|
|
- // [cell.anameLabel sizeToFit];
|
|
|
|
|
- // DebugLog(@"cellForRowAtIndexPath%@",[field valueForKey:@"aname"]);
|
|
|
|
|
- // Configure the cell...
|
|
|
|
|
- // CGRect rect = cell.frame;
|
|
|
|
|
- // [self.content set_itemheight:100 AtIndexPath:indexPath];
|
|
|
|
|
|
|
+// UIView * lineview = [[LineView alloc] initWithFrame:cell.contentView.frame];
|
|
|
|
|
+// lineview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件
|
|
|
|
|
+// lineview.backgroundColor = [UIColor clearColor];// 设为透明从而使得cell.backgroundColor有效.
|
|
|
|
|
+// lineview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
|
+// [cell.contentView addSubview:lineview];// cell.contentView是个readonly属性,所以别想着替换contentView了.
|
|
|
return cell;
|
|
return cell;
|
|
|
|
|
+// float width = tableView.frame.size.width;
|
|
|
|
|
+//
|
|
|
|
|
+// width-=CELL_MARGIN*2;
|
|
|
|
|
+// CGSize constraintkey = CGSizeMake(width*0.4-2*LABEL_MARGIN, 20000.0f);//key label width is 40% cell width;
|
|
|
|
|
+// CGSize constraintval = CGSizeMake(width*0.6-2*LABEL_MARGIN, 20000.0f);//val label width is 60% cell width;
|
|
|
|
|
+// NSDictionary* item = [self.content get_item_seg:indexPath.section row:indexPath.row];
|
|
|
|
|
+// NSString* key =[item allKeys][0];
|
|
|
|
|
+// // [cell.keyLabel sizeToFit];
|
|
|
|
|
+// NSString* val=[item valueForKey:key];
|
|
|
|
|
+// if([val isEqual:[NSNull null]])
|
|
|
|
|
+// val=@"";
|
|
|
|
|
+// if(val==nil)
|
|
|
|
|
+// val=@"";
|
|
|
|
|
+// if([val isEqualToString:@"null"])
|
|
|
|
|
+// val=@"";
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// CGRect frame;
|
|
|
|
|
+// frame.size = constraintval;
|
|
|
|
|
+// frame.origin.x=0;
|
|
|
|
|
+// frame.origin.y=0;
|
|
|
|
|
+// RTLabel* rtlabel = [[RTLabel alloc] initWithFrame:frame];
|
|
|
|
|
+// [rtlabel setLineBreakMode: RTTextLineBreakModeWordWrapping];
|
|
|
|
|
+// // rtlabel.lineSpacing = 20.0;
|
|
|
|
|
+// [rtlabel setText: val];
|
|
|
|
|
+// CGSize sizeval=rtlabel.optimumSize;
|
|
|
|
|
+// CGSize sizekey = [key sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
+// // CGSize sizeval = [val sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:constraintval lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
+//// DebugLog(@"tableView width:%f",width);
|
|
|
|
|
+////
|
|
|
|
|
+//// DebugLog(@"key width= %f val width = %f",constraintkey.width,constraintval.width);
|
|
|
|
|
+//// DebugLog(@"key = %@ val = %@",key,val);
|
|
|
|
|
+// float height = MAX(sizekey.height,sizeval.height);
|
|
|
|
|
+// height = MAX(height, DEF_CELL_HEIGHT-LINE_WIDTH);
|
|
|
|
|
+// sizekey.height = height;
|
|
|
|
|
+// sizekey.width = constraintkey.width;
|
|
|
|
|
+// // sizeval.height = height;
|
|
|
|
|
+// sizeval.width =constraintval.width;
|
|
|
|
|
+//
|
|
|
|
|
+// NSString *CellIdentifier = @"detail_item_kv";
|
|
|
|
|
+// DetailCellKV *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
|
|
+// if(cell==nil)
|
|
|
|
|
+// DebugLog(@"cell is nil.........................");
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // CGRect framekey ;
|
|
|
|
|
+// // framekey.origin.x=CELL_MARGIN;
|
|
|
|
|
+// // framekey.origin.y=LINE_WIDTH;
|
|
|
|
|
+// // framekey.size = sizekey;
|
|
|
|
|
+// // UILabel* keyLabel = [[UILabel alloc]initWithFrame:framekey];
|
|
|
|
|
+// // keyLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
|
+// // keyLabel.backgroundColor = [UIColor grayColor];
|
|
|
|
|
+// // keyLabel.text = key;
|
|
|
|
|
+// //
|
|
|
|
|
+// // CGRect frameval;
|
|
|
|
|
+// // frameval.origin.x=constraintkey.width+CELL_MARGIN;
|
|
|
|
|
+// // frameval.origin.y=LINE_WIDTH;
|
|
|
|
|
+// // frameval.size = sizeval;
|
|
|
|
|
+// //
|
|
|
|
|
+// // UILabel* valLabel = [[UILabel alloc]initWithFrame:frameval];
|
|
|
|
|
+// // valLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
|
+// // valLabel.text = val;
|
|
|
|
|
+// //
|
|
|
|
|
+// // for(UIView* v in cell.contentView.subviews)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // [v removeFromSuperview];
|
|
|
|
|
+// //
|
|
|
|
|
+// // }
|
|
|
|
|
+// //
|
|
|
|
|
+// // [cell.contentView addSubview:keyLabel];
|
|
|
|
|
+// // [cell.contentView addSubview:valLabel];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// CGRect framekey = cell.keyLabel.frame;
|
|
|
|
|
+// framekey.origin.x=CELL_MARGIN+LABEL_MARGIN;
|
|
|
|
|
+// framekey.origin.y=LINE_WIDTH;
|
|
|
|
|
+// framekey.size = sizekey;
|
|
|
|
|
+// cell.keyLabel.frame = framekey;
|
|
|
|
|
+// cell.keyLabel.text=key;
|
|
|
|
|
+// CGRect frameval = cell.valLabel.frame;
|
|
|
|
|
+// frameval.origin.x=constraintkey.width+CELL_MARGIN+3*LABEL_MARGIN; //2 margin for key 1 margin for value self
|
|
|
|
|
+// frameval.origin.y=LINE_WIDTH;
|
|
|
|
|
+// frameval.size = sizeval;
|
|
|
|
|
+// cell.valLabel.frame = frameval;
|
|
|
|
|
+// // [cell.valLabel setTextAlignment:RTTextAlignmentCenter];
|
|
|
|
|
+// cell.valLabel.text= val;
|
|
|
|
|
+// CGPoint rcenter;
|
|
|
|
|
+// rcenter.x = width * 0.4+width * 0.6/2;
|
|
|
|
|
+// rcenter.y = height /2;
|
|
|
|
|
+// cell.valLabel.center=rcenter;
|
|
|
|
|
+//// cell.valLabel.backgroundColor =[UIColor redColor];
|
|
|
|
|
+//
|
|
|
|
|
+//// cell.contentView.superview.backgroundColor = [UIColor clearColor];
|
|
|
|
|
+//// cell.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
+// UIView * lineview = [[LineView alloc] initWithFrame:cell.contentView.frame];
|
|
|
|
|
+// lineview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件
|
|
|
|
|
+// lineview.backgroundColor = [UIColor clearColor];// 设为透明从而使得cell.backgroundColor有效.
|
|
|
|
|
+// lineview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
|
+// [cell.contentView addSubview:lineview];// cell.contentView是个readonly属性,所以别想着替换contentView了.
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // [cell.valLabel sizeToFit];
|
|
|
|
|
+// // cell.anameLabel.text = [field valueForKey:@"aname"];
|
|
|
|
|
+// // [cell.anameLabel sizeToFit];
|
|
|
|
|
+// // DebugLog(@"cellForRowAtIndexPath%@",[field valueForKey:@"aname"]);
|
|
|
|
|
+// // Configure the cell...
|
|
|
|
|
+// // CGRect rect = cell.frame;
|
|
|
|
|
+// // [self.content set_itemheight:100 AtIndexPath:indexPath];
|
|
|
|
|
+// return cell;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|