次のコードは役に立ちます
ケース1:
-(float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 100.0;
}
// 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];
UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
image.tag = 101;
[cell addSubview:image];
}
UIImageView *imageObj =(UIImageView *)[cell viewWithTag:101];
[imageObj setImage:[UIImage imageNamed:@"url.jpeg"]];
// Set up the cell...
return cell;
}
アウトプット:

そしてCase2:
-(float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 200.0;
}
// 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];
UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
image.tag = 101;
[cell addSubview:image];
}
UIImageView *imageObj =(UIImageView *)[cell viewWithTag:101];
[imageObj setImage:[UIImage imageNamed:@"url.jpeg"]];
// Set up the cell...
return cell;
}
出力:

実際の画像サイズは460x246ですが、フレームによって違いがわかります
ありがとうございました