【发布时间】:2013-08-11 13:17:46
【问题描述】:
我正在制作一个 UITableView,每个单元格都有一个 UIIMage。
为了为每个单元格设置不同的图像,我在项目中加载了所有图像并创建了一个包含所有图像_flagsArray = [NSArray arrayWithObjects: @"flag_Italia.png", @"flag_USA", nil]; 的数组。
在cellForRowAtIndexPath我写了
UIImageView * flagImageView = (UIImageView *) [self.view viewWithTag:1]; //declaration of UIImageView in cell
UIImage * flagImage = (UIImage *)[_flagsArray objectAtIndex:indexPath.row]; //read UImage
[flagImageView setImage : flagImage]; //should assign UImage to UIImageView
运行它时出现日志*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString size]: unrecognized selector sent to instance 0xcbdc' 崩溃,第三行出现信号 SIGABRT 但我不明白为什么,出了什么问题?
谢谢!
【问题讨论】:
标签: uitableview uiimageview uiimage nscfstring