Я нахожусь в процессе создания моего открытого вида сетки.
Я создал пользовательскую ячейку, которая выглядит следующим образом:
![enter image description here](https://i.stack.imgur.com/dnBBP.png)
Я выполняю заполнение следующим образом:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"Cell";
TableGalleryCustomCell *cell = (TableGalleryCustomCell*)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if( cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TableGalleryCustomCell" owner:nil options:nil];
for (id currentObject in topLevelObjects) {
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell = (TableGalleryCustomCell*)currentObject;
break;
}
}
}
if (countingIndex < [[[self.appDelegate rssParser] rssItems] count]) {
cell.firstAddress.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Address];
cell.firstPrice.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Deposit];
if ([[[[[[self appDelegate] rssParser]rssItems]objectAtIndex:countingIndex] imageURLs] count] != 0 ) {
[cell.firstImage setImageWithURL:[NSURL URLWithString:[[[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] imageURLs] objectAtIndex:0.0]]];
cell.firstImage.tag = countingIndex;
}
}
countingIndex++;
if (countingIndex < [[[self.appDelegate rssParser] rssItems] count]) {
cell.secondAddress.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Address];
cell.secondPrice.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Deposit];
if ([[[[[[self appDelegate] rssParser]rssItems]objectAtIndex:countingIndex] imageURLs] count] != 0 ) {
[cell.secondImage setImageWithURL:[NSURL URLWithString:[[[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] imageURLs] objectAtIndex:0.0]]];
cell.secondImage.tag = countingIndex;
}
}
countingIndex++;
if (countingIndex < [[[self.appDelegate rssParser] rssItems] count]) {
cell.thirdAddress.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Address];
cell.thirdPrice.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Deposit];
if ([[[[[[self appDelegate] rssParser]rssItems]objectAtIndex:countingIndex] imageURLs] count] != 0 ) {
[cell.thirdImage setImageWithURL:[NSURL URLWithString:[[[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] imageURLs] objectAtIndex:0.0]]];
cell.thirdImage.tag = countingIndex;
}
}
countingIndex++;
if (countingIndex < [[[self.appDelegate rssParser] rssItems] count]) {
cell.fourthAddress.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Address];
cell.fourthPrice.text = [[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] Deposit];
if ([[[[[[self appDelegate] rssParser]rssItems]objectAtIndex:countingIndex] imageURLs] count] != 0 ) {
[cell.fourthImage setImageWithURL:[NSURL URLWithString:[[[[[self.appDelegate rssParser] rssItems] objectAtIndex:countingIndex] imageURLs] objectAtIndex:0.0]]];
cell.fourthImage.tag = countingIndex;
}
}
countingIndex++;
return cell;
}
Этонемного грязно, но это работает ..... пока я не прокручиваю.После того, как изображение загружено, затем прокручивается с экрана, изображение исчезает.
Я полагаю, что это может быть из-за потери изображения ячеек?
Я попробовал точно такую же реализацию, но только с 1 imageView в каждой ячейке, и все прекрасно работает.
Любая точка в правильном направлении будет очень цениться.
Я ценю любую помощь и спасибо за ваше время.