菜鸟请教cell设计问题
cell分成两列显示,第一列是titlelabel,第二列是两列多行的detaillabel(这个label的行数根据array中保存的数量来定)
textvalue是一个nsstring:物品名称,申领数量;计算器,0;
最后显示是在titlelabel中老是多显示():(一对括号加一个冒号),不知道是为什么,请大侠指导,非常感谢。
UILabel *titleLabel = (UILabel *)[cell.contentView viewWithTag:kTagTitleLabel];
titleLabel.text = @"物品详情";
if (textValue != nil) {
NSUInteger textLength = [textValue length];
while( [textValue length] != 0) {
NSMutableDictionary *textDic = [[NSMutableDictionary alloc] initWithCapacity:10];
NSInteger locoal = [textValue rangeOfString:@","].location;
NSString *name = [textValue substringToIndex:locoal];
[textDic setObject:name forKey:@"name"];
NSString *temp = [textValue substringFromIndex:locoal+1];
textValue = temp;
textLength = [textValue length];
locoal = [textValue rangeOfString:@";"].location;
NSString *value = [textValue substringToIndex:locoal];
[textDic setObject:value forKey:@"value"];
temp = [textValue substringFromIndex:locoal+1];
textValue = temp;
NSLog(@"textvalue length = %d", [textValue length]);
[textArray addObject:textDic];
[textDic release];
}
for (NSUInteger i = 0; i < [textArray count]; i++) {
NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithCapacity:10];
//get value from text array
dic = [textArray objectAtIndex:i];
NSString *name = [dic objectForKey:@"name"];
NSString *value =[dic objectForKey:@"value"];
UILabel *detailLabel1 = (UILabel *)[cell.contentView viewWithTag:(kTagLastRowLineView+(i*2+1))];
UILabel *detailLabel2 = (UILabel *)[cell.contentView viewWithTag:(kTagLastRowLineView+(i*2+2))];
detailLabel1.text = name;
detailLabel2.text = value;
}
}