菜鸟请教cell设计问题

stranger_han stranger_han 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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;

}

}
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
stranger_han
iOS 29,038 成员 12,459 内容