다음 코드 조각은 iPad 시뮬레이터와 iPhone 시뮬레이터를 사용하여 잘 작동합니다. 그러나있는 UIImage 내가UIImage : ipad의 imageNamed가 시뮬레이터에서 실패합니다.
- (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;
}
이이 튜토리얼 책에서 찍은 빌리 기본 아이폰의 예이며,이 문제가있는 1 시간 (아이폰 모드를 사용) 아이 패드 2에서 실행 전무 (디버깅 동안 확인)입니다 발생했습니다.
오류 메시지가 무엇입니까? 섹션이 올바르게 설정되어 있습니까? – Alexander
이미지가 앱에 포함되어 있으며 맞춤법을 검사 했습니까? 대문자 소문자? – Eiko