w moim UITableView Chcę ustawić dla pierwszych wiadomości RSS rss niestandardowy tableViewCell (typ A pozwala powiedzieć) i dla innych wiadomości drugi, trzeci itp .. inny niestandardowy tableViewCell (trype B) problemem jest to, że niestandardowy tableViewCell (trype A) stworzony dla pierwszych wiadomości jest ponownie wykorzystywany, ale z ciekawością liczba wierszy między pierwszym użyciem customViewCell (typ A) i drugim wyglądem tego samego typu customViewCell jest nie równy ..2 różne typy niestandardowych UITableViewCells w UITableView
my cellForRowAtIndexPath wygląda to tak.
- (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;
}
dwa typy komórek mają różne wysokości, które są ustawione poprawnie. Czy ktoś mógłby wskazać mi właściwy kierunek, w jaki sposób ustawić niestandardową komórkę typu A, aby pojawiała się tylko w przypadku pierwszych wiadomości (które nie są ponownie wykorzystywane)? dziękuję
dla Szybka wersja tego pytania zobacz [tutaj] (http://stackoverflow.com/ pytania/30774671/uitableview-with-more-than-one-custom-cell-with-swift) – Honey