我正在尝试UIImage
使用以下代码将我的 web 服务添加到我的 NSMutableArray:
for (int i=0; i<[totalRowCountString intValue]; i++)
{
NSString *criticsRatingString = [[JSON valueForKeyPath:@"movies.ratings.critics_rating"] componentsJoinedByString:@" "];
NSLog(@"criticsRatingString: %@", criticsRatingString);
if ([criticsRatingString isEqualToString:@"Certified Fresh"])
{
self.ratingImage = [UIImage imageNamed:@"rt_certified_fresh.png"];
}
else if ([criticsRatingString isEqualToString:@"Fresh"])
{
self.ratingImage = [UIImage imageNamed:@"rt_fresh.png"];
}
else if ([criticsRatingString isEqualToString:@"Rotten"])
{
self.ratingImage = [UIImage imageNamed:@"rt_rotten.png"];
}
else if ([criticsRatingString isEqualToString:@"Spilled"])
{
self.ratingImage = [UIImage imageNamed:@"rt_spilled.png"];
}
else if ([criticsRatingString isEqualToString:@"Upright"])
{
self.ratingImage = [UIImage imageNamed:@"rt_upright.png"];
}
[tomatorRatingImages addObject:self.ratingImage];
NSLog(@"tomatoRatingImages: %@", tomatorRatingImages);
}
但是我的tomatoRatingImages 的NSLog 返回NULL。任何想法为什么它返回NULL?
更新:我的 NSMutableArray 已经在我的 viewWillAppear 方法中初始化。