右側のセルに表示する一連の画像を Web サーバーから読み込んでいます。ただし、画像のサイズが異なるため、リストが表示されたときに不均一に見えます。画像を 100 x 80 のような固定サイズに設定できる方法はありますか?
このセクションのコードは次のとおりです。
cell.lotImageView.image = [UIImage imageNamed:@"blankthumbnail.png"];
cell.lotImageView.clipsToBounds = YES;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
//load image from web server
NSString *strURL = [NSString stringWithFormat:@"%@/images/%@", user.url, lotPhoto[row]];
NSURL *url = [[NSURL alloc] initWithString:strURL ];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
dispatch_async(dispatch_get_main_queue(), ^{
// let's make sure the cell is still visible (i.e. hasn't scrolled off the screen)
mainTableCell *cell = (mainTableCell *)[tableView cellForRowAtIndexPath:indexPath];
if (cell)
{
cell.lotImageView.clipsToBounds = YES;
cell.lotImageView.image =image;
}
});
});