사용자 정의 UITableViewCell
이 있습니다. 셀이 선택되면 UILabel
이 추가됩니다. 내가 그렇게처럼 혼란스러워하지 않도록하기위한 prepareForReuse
를 사용했다 : 내가 충분히 아래로 스크롤 할 때선택한 셀에 대해 prepareForReuse 사용 안 함
- (void)prepareForReuse {
NSArray *viewsToRemove = [self.view subviews];
for (UILablel *label in viewsToRemove) {
[label removeFromSuperview];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CategorieCell *customCell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath];
return customCell;
}
문제는 레이블이보기를 벗어 났음, 그리고 내가 위로 다시 스크롤 레이블이 아니다 더 이상. 그 이유는 세포가 재사용 될 때 모든 라벨을 제거했기 때문입니다.
그래서 선택된 행에 대해 prepareForReuse
(또는 메소드의 코드 만)을 비활성화하는 방법이 있습니까?
이해 못하셨습니까? 명확하게 설명해주십시오. – Saif
어느 부분을 이해하지 못합니까? –
Cell For Row 메서드를 게시 할 수 있습니까? – Saif