UIImage可能无法响应imageWithContentsofFile

时间:2013-03-31 01:30:36

标签: uiimage theos logos

大家好,我试图在调用方法时显示图像。

这是我的代码

#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

这是我的错误代码 我不断收到错误UIImage可能无法响应+ imageWithContentsofFile。 有人可以帮帮我吗?

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 个答案:

答案 0 :(得分:1)

它是imageWithContents**Of**File,而不是imageWithContentsofFile

此外,该图像不会加载。当您的代码在您的设备上运行时,该路径位于您的本地计算机上。您应该使用layout/目录。

相关问题