오른쪽 셀에 표시되도록 웹 서버에서 이미지 세트를로드하고 있습니다. 그러나 이미지는 다른 크기로 제공되므로 목록이 표시 될 때라도 유엔 상태로 보입니다. 이미지를 100 x 80과 같은 고정 크기로 설정할 수 있습니까?xcode ios : 셀 이미지 크기를 설정하십시오.
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;
}
});
});
예상 크기로 이미지 크기를 조정하는 최고의 자습서 : http://mobiledevelopertips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html –
imageView에 프레임 추가 cell.lotImageView setFrame : CGrectMake (0,0,100,80)]; – AppleDelegate