开发者

iPhone multiple image loading

    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开发者_如何学Python error:nil];


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

I want to display the image url(resultstring) to a tableview. I refer three20 and lazytable, but it did not work for me. tableview code given below

- (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;
}

Please help me


For this purpose you have to load the table images asynchronously.

well there are a lot of good working libraries to achieve this

  1. asynchImageView
  2. SDWebimage
  3. AFNetworking Extension class for imageView
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜