Objective c 单元格中的文本复制,直到我滚动[图像]才显示

Objective c 单元格中的文本复制,直到我滚动[图像]才显示,objective-c,uitableview,Objective C,Uitableview,因此,我在tableView中加载了一个YouTube频道,并试图添加正确的持续时间,但有时它根本不显示,当它显示时,如果你仔细看,它后面会有另一个文本 当你看图像1时,你可以看到,在我滚动到一个视频上之前,它没有时间 当您查看图2时,可以看到文本标签在某些位置重复 代码 -(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { 静态NSString*C

因此,我在tableView中加载了一个YouTube频道,并试图添加正确的持续时间,但有时它根本不显示,当它显示时,如果你仔细看,它后面会有另一个文本

当你看图像1时,你可以看到,在我滚动到一个视频上之前,它没有时间

当您查看图2时,可以看到文本标签在某些位置重复

代码

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
静态NSString*CellIdentifier=@“Cell”;
ChanelFeeds*currentFeed=[[xmlParser feeds]objectAtIndex:indexPath.row];
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
如果(单元格==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle重用标识符:CellIdentifier]自动释放];
totalTime=[self timeFormatted:([currentFeed duration].intValue)-1];

如果([totalTime length]可能会更改为-

if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
然后,区块-

totalTime = [self timeFormatted:([currentFeed duration].intValue)-1];
    if([totalTime length] <= 4) {

        CGRect contentFrame6 = CGRectMake(0, 66, 30, 13);
        CGRect contentFrame7 = CGRectMake(6, 65, 60, 15);
        UILabel *title3 = [[UILabel alloc] initWithFrame:contentFrame7];
        UIImageView *imv5 = [[UIImageView alloc]initWithFrame:contentFrame6];

        imv5.image=[UIImage imageNamed:@"blackBorder.png"];
        imv5.alpha = 0.8;
        [cell.contentView addSubview:imv5];

        title3.tag = 0013;
        title3.numberOfLines = 1;
        title3.font = [UIFont boldSystemFontOfSize:10];
        [cell.contentView addSubview:title3];
        title3.text = totalTime;
        title3.textColor = [UIColor whiteColor];
        title3.backgroundColor = [UIColor clearColor];
        imv5.backgroundColor = [UIColor clearColor];
        [imv5 release];
        [title3 release];
    } else if([totalTime length] == 5) {
        CGRect contentFrame6 = CGRectMake(87, 64, 30, 13);
        CGRect contentFrame7 = CGRectMake(90, 63, 60, 15);
        UILabel *title3 = [[UILabel alloc] initWithFrame:contentFrame7];
        UIImageView *imv5 = [[UIImageView alloc]initWithFrame:contentFrame6];

        imv5.image=[UIImage imageNamed:@"blackBorder.png"];
        imv5.alpha = 0.8;
        [cell.contentView addSubview:imv5];

        title3.tag = 0013;
        title3.numberOfLines = 1;
        title3.font = [UIFont systemFontOfSize:10];
        [cell.contentView addSubview:title3];
        title3.text = totalTime;
        title3.textColor = [UIColor whiteColor];
        title3.backgroundColor = [UIColor clearColor];
        imv5.backgroundColor = [UIColor clearColor];
        [imv5 release];
        [title3 release];
    }

}else{
    NSData* imageDataTemp = [[NSData alloc] initWithContentsOfURL:[currentFeed thumbnailURL]];
    if(imageDataTemp){
        cell.imageView.image = [UIImage imageWithData:imageDataTemp];
    }else{
        cell.imageView.image = [UIImage imageNamed:@"youtubeLogo.png"];
    }


}
totalTime=[self timeFormatted:([currentFeed duration].intValue)-1];

如果([totalTime length]是的,但是你把图像放在计时器的顶部。你会更清楚:),我的观点是代码应该在
如果(cell==nil){}
totalTime = [self timeFormatted:([currentFeed duration].intValue)-1];
    if([totalTime length] <= 4) {

        CGRect contentFrame6 = CGRectMake(0, 66, 30, 13);
        CGRect contentFrame7 = CGRectMake(6, 65, 60, 15);
        UILabel *title3 = [[UILabel alloc] initWithFrame:contentFrame7];
        UIImageView *imv5 = [[UIImageView alloc]initWithFrame:contentFrame6];

        imv5.image=[UIImage imageNamed:@"blackBorder.png"];
        imv5.alpha = 0.8;
        [cell.contentView addSubview:imv5];

        title3.tag = 0013;
        title3.numberOfLines = 1;
        title3.font = [UIFont boldSystemFontOfSize:10];
        [cell.contentView addSubview:title3];
        title3.text = totalTime;
        title3.textColor = [UIColor whiteColor];
        title3.backgroundColor = [UIColor clearColor];
        imv5.backgroundColor = [UIColor clearColor];
        [imv5 release];
        [title3 release];
    } else if([totalTime length] == 5) {
        CGRect contentFrame6 = CGRectMake(87, 64, 30, 13);
        CGRect contentFrame7 = CGRectMake(90, 63, 60, 15);
        UILabel *title3 = [[UILabel alloc] initWithFrame:contentFrame7];
        UIImageView *imv5 = [[UIImageView alloc]initWithFrame:contentFrame6];

        imv5.image=[UIImage imageNamed:@"blackBorder.png"];
        imv5.alpha = 0.8;
        [cell.contentView addSubview:imv5];

        title3.tag = 0013;
        title3.numberOfLines = 1;
        title3.font = [UIFont systemFontOfSize:10];
        [cell.contentView addSubview:title3];
        title3.text = totalTime;
        title3.textColor = [UIColor whiteColor];
        title3.backgroundColor = [UIColor clearColor];
        imv5.backgroundColor = [UIColor clearColor];
        [imv5 release];
        [title3 release];
    }

}else{
    NSData* imageDataTemp = [[NSData alloc] initWithContentsOfURL:[currentFeed thumbnailURL]];
    if(imageDataTemp){
        cell.imageView.image = [UIImage imageWithData:imageDataTemp];
    }else{
        cell.imageView.image = [UIImage imageNamed:@"youtubeLogo.png"];
    }


}