CGRect viewRect=self.view.frame;
//画基本信息
NSDictionary *basicInformDic=(NSDictionary *)[[[dic objectForKey:@"returnResult"] objectForKey:@"dtBasicInform"] objectAtIndex:0];
NSDictionary *wageInformDic=(NSDictionary *)[[[dic objectForKey:@"returnResult"] objectForKey:@"dtWageInform"] objectAtIndex:0];
CGRect basicInformRect=CGRectMake(106,20, viewRect.size.width-106, 200);
NSArray* basicLabelArray=[NSArray arrayWithObjects:@"姓名",@"出生日期",@"文化程度",@"取得时间",
@"男",@"籍贯",@"毕业时间",@"政治面貌",
@"民族",@"身份证号",@"学位",@"加入时间",
nil];
[self drawGrid:basicInformDic andBakDic:wageInformDic andWidthLabelNumber:3 andHeightLabelNumber:4 andRect:basicInformRect andLabelArray:basicLabelArray];
//画工资信息
CGRect wageInformRect=CGRectMake(20, 200+20, viewRect.size.width-20, 300);
NSArray* wageLabelArray=[NSArray arrayWithObjects:@"单位",@"职务级别",@"岗位工资标准",
@"员工编号",@"职称",@"合同编号",
@"工作岗位",@"取得资格日期",@"合同类型",
@"工作时间",@"公子序列",@"开始日期",
@"工龄起算日",@"岗级",@"结束日期",
@"首次加入中石油日期",@"档次",
nil];
[self drawGrid:basicInformDic andBakDic:wageInformDic andWidthLabelNumber:2 andHeightLabelNumber:9 andRect:wageInformRect andLabelArray:wageLabelArray];
-(void)drawGrid:(NSDictionary *)informDic andBakDic:(NSDictionary *)informDicBak andWidthLabelNumber:(float )widthLabelNumber andHeightLabelNumber:(float )heightLabelNumber andRect:(CGRect )informRect andLabelArray:(NSArray *)labelArray
{
float labelLength=informRect.size.width/widthLabelNumber/2;
float labelHeitht=informRect.size.height/heightLabelNumber;
for (NSUInteger i=0; i<heightLabelNumber; i++)
{
for (NSUInteger j=0; j<widthLabelNumber; j++) {
if (i*widthLabelNumber+j>[labelArray count]-1) {
continue;
}
UILabel *lKey = [[UILabel alloc] initWithFrame:CGRectMake(informRect.origin.x+j*labelLength*2,
informRect.origin.y+i*labelHeitht,
labelLength, labelHeitht)];
lKey.font = [UIFont systemFontOfSize:14.0f];
lKey.text = [NSString stringWithFormat:@"%@:",[labelArray objectAtIndex:i*widthLabelNumber+j]];
lKey.backgroundColor = [UIColor clearColor];
lKey.textColor = [UIColor blueColor];
lKey.textAlignment = UITextAlignmentRight;
[self.view addSubview:lKey];
//value
UILabel *lValue = [[UILabel alloc] initWithFrame:CGRectMake(informRect.origin.x+j*labelLength*2+labelLength,
informRect.origin.y+i*labelHeitht,
labelLength, labelHeitht)];
lValue.font = [UIFont systemFontOfSize:14.0f];
lValue.text = [informDic objectForKey: [labelArray objectAtIndex:i*widthLabelNumber+j]];
lValue.backgroundColor = [UIColor clearColor];
lValue.textColor = [UIColor blackColor];
lValue.textAlignment = UITextAlignmentLeft;
[self.view addSubview:lValue];
}
}
}