Загрузка нескольких изображений на iPhone

#iphone

#iPhone

Вопрос:

     NSString *urlVal = @"http://at.azinova.info/green4care/iphone/viewImage.php?id=";

    NSString *urlVal1 = [urlVal stringByAppendingString:selectedCountryw];



    NSURL *url1 = [NSURL URLWithString:urlVal1];

    NSString *resultString = [NSString stringWithContentsOfURL:url1 encoding:NSUTF8StringEncoding error:nil];


    NSMutableArray *arycountries2 = [resultString componentsSeparatedByString:@"#***#"];
    arraycountries = [[NSMutableArray alloc]initWithArray:arycountries2];
  

Я хочу отобразить URL-адрес изображения (resultstring) в виде таблицы. Я ссылаюсь на three20 и lazytable, но у меня это не сработало. приведенный ниже код просмотра таблицы

 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [arraycountries count];
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.imageView.image = [UIImage imageNamed:[arraycountries objectAtIndex:indexPath.row]];


    return cell;
}
  

Пожалуйста, помогите мне

Комментарии:

1. спасибо кришнабхадре .. теперь я знаю, как принять ответ

2. Вы хотите отобразить изображение в ячейке?

3. Пожалуйста, не создавайте новые учетные записи, чтобы снова задавать один и тот же неудачный вопрос. Это считается злоупотреблением системой и может привести к приостановке.

4. как поместить приведенный выше код в json-фреймворк??

Ответ №1:

Для этой цели вы должны загружать изображения таблиц асинхронно.

что ж, для достижения этой цели существует множество хороших рабочих библиотек

  1. asynchImageView
  2. SDWebImage
  3. Класс расширения AFNetworking для ImageView