【发布时间】:2012-09-24 12:04:29
【问题描述】:
以下代码 sn-p 使用 iPad 模拟器和 iphone 模拟器可以正常工作。但是,当我在 ipad 2(使用 iphone 模式)上运行 UIImage 时,UIImage 为零(在调试时检查)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"flowerCell"];
switch (indexPath.section) {
case kRedSection:
cell.textLabel.text=[self.redFlowers objectAtIndex:indexPath.row];
break;
case kBlueSection:
cell.textLabel.text=[self.blueFlowers objectAtIndex:indexPath.row];
break;
default:
cell.textLabel.text=nil;
}
NSString *img=[[NSString alloc] initWithFormat:@"%@%@", cell.textLabel.text, @".png"];
UIImage *flowerImage=[UIImage imageNamed:img];
cell.imageView.image=flowerImage;
return cell;
}
这是一个来自教程书中的 billy 基本 iphone 示例,并且是第一次出现此问题。
【问题讨论】:
-
错误信息是什么?您确定您的部分设置正确吗?
-
图片是否包含在您的应用中,您是否检查过拼写?大写/小写?
标签: ios xcode cocoa-touch ipad ios-simulator