2013-03-31 3 views
1

안녕하세요 여러분, 내 메서드가 호출 될 때마다 이미지를 표시하려고합니다.UIImage가 imageWithContentsofFile에 응답하지 않을 수 있습니다.

여기 여기 내 오류 코드 내가있는 UIImage가 + imageWithContentsofFile에 응답하지 않을 수 있습니다 오류가 계속 내 코드

#import <UIKit/UIKit.h> 
#import <substrate.h> 
#import <Foundation/Foundation.h> 
#import <UIKit/UISaveToCameraRollActivity.h> 
#import <UIKit/_UIImageViewExtendedStorage.h> 
#import <UIKit/_UIOnePartImageView.h> 
#import <UIKit/_UIPrefTableCellPiece.h> 
#import <UIKit/_UIStretchableImage.h> 
#import <UIKit/_UISwitchSlider.h> 
#import <UIKit/_UITableViewCellDeleteConfirmationControl.h> 
#import <UIKit/UIImage.h> 

%hook UISaveToCameraRollActivity 
-(void)performActivity { 
%orig; 
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake (100, 200, 100, 100)]; 
imageView.image = [UIImage imageWithContentsofFile:@"/Users/Cyrus/test/pic.png"]; 
} 
%end 

입니다. 누군가 나를 도와주세요.

Tweak.xm:17: warning: ‘UIImage’ may not respond to ‘+imageWithContentsofFile:’ 
Tweak.xm:17: warning: (Messages without a matching method signature 
Tweak.xm:17: warning: will be assumed to return ‘id’ and accept 
Tweak.xm:17: warning: ‘...’ as arguments.) 

감사합니다. 정말로 모든 도움에 감사드립니다.

답변

1

imageWithContents**Of**File이 아니라 imageWithContentsofFile입니다.

또한 이미지가로드되지 않습니다. 코드가 장치에서 실행되는 동안 경로는 로컬 컴퓨터에 있습니다. layout/ 디렉토리를 사용해야합니다.

+0

많은 도움을 주셔서 감사합니다. 또한 레이아웃/형식의 의미를 설명 할 수 있습니다. 나는 그것의 앞에 havent를 듣는가? 다시 한 번 감사드립니다. –

+0

예를 들면 천 단어가 가치가 있습니다. https://github.com/rpetrich/BrowserChooser 더 많은 도움이 필요하면 알려주세요! –

+0

고마워,이 사람이 처음 엔이 웹 사이트에서 나를 도우려는 첫 번째 인물이다. –