Search code examples
iosobjective-cinterfaceobjective-c-categorymethod-call

How to call method in secondary @interface in .h file


I have two @interface in single .h file. I want to access a method in secondary @interface.

My header file's name is MyImage.h

@interface MyImage : NSObject

- (void)addImage:(UIImage *)image forName:(NSString*)fileName;

- (void)clearImageCache;

@end

@interface UIImageView (URL_Loading)

- (void)setImageWithURL:(NSURL *)url;

- (void)setImageWithURL:(NSURL *)url
   placeholderAsSpinner:(BOOL)spinnerEnabled;

@end

Can anybody tell me how to call setImageWithURL: method


Solution

  • @interface UIImageView (URL_Loading)

    is a category of UIImageView so it is adding 2 new methods.

    Import header and call it within a UIImageView

    Example:

    [yourImageView setImageWithURL:url];