【发布时间】:2011-02-12 21:39:21
【问题描述】:
我在 iPhone 3.x 应用程序中有一个自定义表格单元格来显示篮球运动员数据,包括一张图片。这是我的表控制器代码:
UIImageView *theImage = (UIImageView *) [cell viewWithTag:0];
theImage.image = [manager getSmallImageForPlayer: data.number];
theImage.frame = CGRectMake(14, 0, 30, 44);
theImage.clipsToBounds = YES;
theImage.contentMode = UIViewContentModeScaleAspectFit;
theImage.autoresizingMask = UIViewAutoresizingFlexibleHeight && UIViewAutoresizingFlexibleWidth;
theImage.autoresizesSubviews = YES;
这是它在 iPhone SDK 3.0 模拟器中的样子:
3.0 simulator screenshot http://img96.imageshack.us/img96/9550/imageintablecell30.png
这是它在 iPhone SDK 3.1.3 模拟器中的样子:
3.1.3 simulator screenshot http://img185.imageshack.us/img185/9269/imageintablecell313.png
所以我有两个问题:
- 在这两个版本中,图像视图从表格单元格中的位置 (0,0) 开始,即使我将框架设置为从 (14,0) 开始。
- 在 3.0 模拟器(和 3.0 设备)中,图像没有正确缩小,即使我将图像视图内容模式设置为“UIViewContentModeScaleAspectFit”。但相同的代码在 3.1.3 模拟器/设备中运行良好。
谁能帮我解决这两个问题?
【问题讨论】:
-
如何将
UIImageView添加到UITableViewCell? -
我没有,它已经在自定义表格单元格 MIB 中,我使用“viewWithTag”从中读取它,然后设置它的属性。
标签: iphone iphone-sdk-3.0 uitableview uiimageview