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];


    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    if(tableView==logTable)
    {

        lbl_description=[[UILabel alloc] init];
        [cell.contentView addSubview:lbl_description];
        lbl_description.backgroundColor = [UIColor clearColor];
        lbl_description.textColor=[UIColor darkGrayColor];
        lbl_description.font = [UIFont systemFontOfSize:18];



        lbl_date=[[UILabel alloc] init];
        [cell.contentView addSubview:lbl_date];
        lbl_date.backgroundColor = [UIColor clearColor];
        lbl_date.textColor=[UIColor lightGrayColor];
        lbl_date.font = [UIFont systemFontOfSize:14];

        lbl_description.frame=CGRectMake(10, 3, 300, 25);
        lbl_date.frame=CGRectMake(10, 23, 300, 25);//left



        lbl_description.text = [getName objectAtIndex:indexPath.row];
        lbl_date.text=[getStartDate objectAtIndex:indexPath.row];

    }

            return cell;
}

UITable 重叠,当我尝试重新加载它时,它不会动态更新自身。我使用表重新加载进行重新加载,但我仍然没有得到解决方案。提前致谢..

4

3 回答 3

0

remove cell==nil loop, the overlapping does not happen..

于 2012-09-29T09:55:09.547 回答
0

Try allocatinge the lbl_date and description label in the if loop of cell= nil and add it to cell contentview it in the same if loop.only add text to the labels outside the if cell== nil loop;what you Are currently doing is allocating and adding the labels every time the delegate method is called

于 2012-09-29T09:56:45.347 回答
0

我认为问题是您的单元格内容大于单元格高度。

heightForRowAtIndexPathUITableView的实现方法

- (CGFloat)tableView:(UITableView *)tv heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 70.0f;
}
于 2012-09-29T09:50:44.637 回答