0
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
// NSLog(@"msgcnt123 %@\n",[messageCount objectAtIndex:indexPath.row]);
NSArray *seperateArray = [[clist objectForKey:[[clist allKeys]objectAtIndex:indexPath.row]]componentsSeparatedByString:@"@"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// NSLog(@"key %@\n",[[clist allKeys]objectAtIndex:indexPath.row]);
cell.textLabel.text = [seperateArray objectAtIndex:0];
// cell.textLabel.text = [contactlist objectAtIndex:indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// NSLog(@"sep %@\n",seperateArray);
if (![[seperateArray objectAtIndex:1] isEqualToString:@"0"]) {
NSLog(@"msgCount %@\n",[seperateArray objectAtIndex:1]);
lblCnt = [[UILabel alloc]initWithFrame:CGRectMake(260, 13, 20, 20)];
lblCnt.backgroundColor = [UIColor lightGrayColor];
lblCnt.textColor = [UIColor blackColor];
lblCnt.text = [seperateArray objectAtIndex:1];
lblCnt.textAlignment = UITextAlignmentCenter;
lblCnt.layer.masksToBounds = YES;
lblCnt.layer.cornerRadius = 2.0f;
[cell.contentView addSubview:lblCnt];
}
else
{
NSLog(@"msgCount1 %@\n",[seperateArray objectAtIndex:1]);
[lblCnt removeFromSuperview];
lblCnt.hidden = YES;
}
return cell;
}
我已經添加在每一行中的標籤,其顯示的信息數received.In didSelect方法消失我讓標籤計數零,所以我可以從多於一排的情況下tableView.In消失標籤在表格視圖標籤中不會消失。的UILabel不UITableView的
你想要什麼..我不明白 – iPatel
clist是什麼,它包含什麼,seperateArray的價值是什麼。 – Dilip
clist是nsmutable dictionary.value in separatearray:aa 1,bb 2,cc 2 – user2003416