trong UITableView của tôi tôi muốn đặt cho các tin tức đầu tiên của một nguồn cấp dữ liệu rss một tableViewCell tùy chỉnh (Loại A cho phép nói) và cho các tin tức thứ hai, thứ ba vv. trype B) vấn đề là tùy chỉnh tableViewCell (trype A) tạo ra cho những tin tức đầu tiên được tái sử dụng, nhưng tò mò số lượng hàng giữa việc sử dụng đầu tiên của customViewCell (loại A) và sự xuất hiện thứ hai của cùng một loại customViewCell là không bằng nhau ..2 loại khác nhau của UITableViewCells tùy chỉnh trong UITableView
cellForRowAtIndexPath của tôi trông giống như thế này.
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
int feedIndex = [indexPath indexAtPosition:[indexPath length] - 1];
Feed *item = [[[[self selectedButton] category] feedsList] objectAtIndex:feedIndex + 1];
static NSString *CellIdentifier = @"Cell";
if(feedIndex == 0){
MainArticleTableViewCell *cell = (MainArticleTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[MainArticleTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
[[[cell subviews] objectAtIndex:0] setTag:111];
}
cell.feed = item;
return cell;
}
else{
NewsTableViewCell *cell = (NewsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[NewsTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier orientation:currentOrientation] autorelease];
[[[cell subviews] objectAtIndex:0] setTag:111];
}
cell.feed = item;
return cell;
}
return nil;
}
hai loại ô có độ cao khác nhau được đặt chính xác. ai đó có thể chỉ cho tôi đi đúng hướng trên làm thế nào để làm cho một loại tế bào tùy chỉnh để xuất hiện chỉ cho những tin tức đầu tiên (không được tái sử dụng)? cảm ơn bạn
cho Phiên bản Swift của câu hỏi này xem [tại đây] (http://stackoverflow.com/ câu hỏi/30774671/uitableview-với-nhiều hơn một-tùy chỉnh-tế bào-với-swift) – Honey