내 프로젝트에 landing_load1 @ 2x ... landing_load4 @ 2x 파일이 있습니다. (단, 비 망막 파일 없음)NSBundle mainBundle pathForResource : @ 2x가 포함되어 있지 않으면 작동하지 않습니다.
이 코드는 작동합니다
for(int x=1; x < 5; x++){
NSString * imageTitle = [NSString stringWithFormat:@"landing_load%[email protected]", x];
UIImage * loadingImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageTitle ofType:@"png"]];
[loadingImages addObject:loadingImage];
}
그러나이 작동하지 않습니다
for(int x=1; x < 5; x++){
NSString * imageTitle = [NSString stringWithFormat:@"landing_load%i", x];
UIImage * loadingImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageTitle ofType:nil]];
[loadingImages addObject:loadingImage];
}
을 그리고이 작동하지 않습니다
for(int x=1; x < 5; x++){
NSString * imageTitle = [NSString stringWithFormat:@"landing_load%i", x];
UIImage * loadingImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageTitle ofType:nil]];
[loadingImages addObject:loadingImage];
}
질문 : 명시 적으로 @ 2x를 호출하거나 파일 유형을 지정할 필요가 없다는 것을 알고 있습니다. 따라서 모든 fi를 명시 적으로 작성하지 않으면 왜 작동하지 않는지 알 수 있습니다. 르네 이름?
참고 : '비'작업의 예에서
이 질문을 업데이트했습니다. @ 2x를 추가하지 않으면 여전히 작동하지 않습니다. 감사합니다 – user3456115