读书人

uitableview cell 数据反复

发布时间: 2012-12-07 11:18:41 作者: rapoo

uitableview cell 数据重复

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {    NSString *CellIdentifier = @"Cell";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];    if (cell == nil) {        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];    }else{        while ([cell.contentView.subviews lastObject] != nil) {            [(UIView*)[cell.contentView.subviews lastObject] removeFromSuperview];  //删除并进行重新分配        }    }

读书人网 >移动开发

热点推荐