---
title: "iOS Dev (57) 解决UITableView重绘导致重叠的问题"
author: "prevention"
date: "2014-03-04T10:59:59Z"
tags: []
categories: ["移动开发"]
slug: "ios-dev-57-uitableview"
draft: false
lastmod: "2014-03-16T22:58:24Z"
id: 2025285
url: "https://prevention.iteye.com/blog/2025285"
---

\- (UITableViewCell \*)tableView:(UITableView \*)tableView cellForRowAtIndexPath:(NSIndexPath \*)indexPath

{

    NSString * cellID = @"basePlayerControlSelected";

 

UITableViewCell * cell = \[tableView dequeueReusableCellWithIdentifier:cellID];

 

if (cell == nil)

{

cell = \[\[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellID];

    }

    else

    {

        while (\[cell.contentView.subviews lastObject] != nil) {

            \[(UIView\*)\[cell.contentView.subviews lastObject] removeFromSuperview];  //删除并进行重新分配

        }

    }

    

    // TODO

 

}

 

参考：http://blog.sina.com.cn/s/blog\_75b6e3a601015u4s.html