필자는 몇 주 동안이 문제를 겪었습니다.(맞춤) 스크롤 후 UITableViewCell이 뒤섞입니다.
기본적으로 내가/아래의 TableView의 타르 내에서 스크롤 할 때 사용자의 모든 콘텐츠가 혼합됩니다 IB 설계 셀 및
필자는 여러 솔루션을 시도했지만 아무 소용이, 당신거야 내 코드를 변명이 잘못 사용 조금.
사람들은 테이블 셀에 대한 subView를 계속 제안하지만 iOS 개발에 아직 전혀 익숙하지 않은 방법이 있습니다. 가능한 대답이 있다면 가능하면 자세하게 설명해주십시오. 다시 한번
, 미안 내 코드 =/- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:MyIdentifier];
NSInteger intCellTag;
NSDictionary *dictionary = [[[self.tableDataSource objectAtIndex: indexPath.section] objectForKey: @"Rows"] objectAtIndex: indexPath.row];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
[[[NSBundle mainBundle] loadNibNamed:@"EventsCustomTVCell" owner:self options:nil] lastObject];
cell = tvCell;
self.tvCell = nil;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.tag = intCellTag;
intCellTag++;
UIImage *customCellBG = [UIImage imageNamed:@"EventsCustomTableCellBG.png"];
UIImageView *customCellBGImageView = [[UIImageView alloc] initWithImage: customCellBG];
customCellBGImageView.contentMode = UIViewContentModeScaleToFill;
cell.backgroundView = customCellBGImageView;
[customCellBGImageView release];
[cell.contentView addSubview:imgThumbnail];
[cell.contentView addSubview:lblName];
[cell.contentView addSubview:lblDescription];
[cell.contentView addSubview:lblDate];
}
imgThumbnail.image = [UIImage imageNamed:[dictionary objectForKey: @"Thumbnail"]];
lblName.text = [dictionary objectForKey:@"Title"];
lblDescription.text = [dictionary objectForKey:@"Description"];
lblDate.text = [dictionary objectForKey:@"Date"];
return cell;
}
이것은 매력처럼 일했습니다! – Andyy