OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在.h文件的辅助@interface中调用方法 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:04
标题: ios - 如何在.h文件的辅助@interface中调用方法

我在单个 .h 文件中有两个 @interface。我想访问辅助@interface 中的方法。

我的头文件名为 MyImage.h

@interface MyImage : NSObject

- (void)addImageUIImage *)image forNameNSString*)fileName;

- (void)clearImageCache;

@end

@interface UIImageView (URL_Loading)

- (void)setImageWithURLNSURL *)url;

- (void)setImageWithURLNSURL *)url
   placeholderAsSpinnerBOOL)spinnerEnabled;

@end

谁能告诉我如何调用 setImageWithURL: 方法



Best Answer-推荐答案


@interface UIImageView (URL_Loading)

UIImageView的一个类别,所以它增加了2个新方法。

导入 header 并在 UIImageView

中调用它

例子:

[yourImageView setImageWithURL:url];

关于ios - 如何在.h文件的辅助@interface中调用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29652515/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4