I have a subclass of UIView, MyView. I also have a category in UIView called UIView + simpleCategory.
This category declares the doSomething method.
@interface UIView (simpleCategory) - (void) doSomething; @end
I'm having problems calling the doSomething method from a subclass of UIView MyView. I get a "selector not detected" error. I was wondering what I need to do to make the subclass recognize the methods of the superclass class.
The problem occurs when calling the method of the UIView category in an instance of my subclass of UIView:
MyView *view = [[MyView alloc] init]; [view doSomething]; // throws selector not found error here
I am wondering if I skip #import somewhere, but I would like to understand the relationship between categories and subclasses.
DECISION::
Apparently my implementation was wonderful. I just needed to add a category to the application. I did this by clicking a category in Project Navigator. Then I clicked on the Utilities icon (the view that opens on the right side of the window) and checked the Target Membership checkbox in the File Inspector menu. That was all that had to be done. Thanks everyone for the answers.
source share