2012-09-12 2 views

답변

2

NSBundle 방법에 이미지가 발견되지 않은 경우

- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)extension 

이 전무를 반환합니다.

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"image1" [email protected]"png"]; 
if(filePath.length > 0 && filePath != (id)[NSNull null]) { 
    UIImage *myImage = [UIImage imageWithContentsOfFile:filePath]; 
} 
+0

감사합니다. 이 메서드는 문자열을 반환하기 때문에 이미지를 찾으면 어떻게 얻습니까? – soleil

+0

[UIImage imageWithContentOfFile : yourFilePath]; – J2theC

+0

내 대답이 업데이트되었습니다. – ohr