views:

25

answers:

1

I added a category to UIView to hold some transition helper methods. The methods are all working; however, I get compiler warnings:

warning: 'UIButton' may not respond to '-fadeOutWithDuration:'

My "UIView+Trans.h" file looks like this:

@interface UIImage (trans)
- (void) fadeOutWithDuration:(CGFloat)duration;
@end

My "UIView+Trans.m" file looks like this:

#import <QuartzCore/QuartzCore.h>
#import "UIView+Trans.h"

@implementation UIView (trans)
- (void) fadeOutWithDuration:(CGFloat) duration {
    //...
}
@end

And I'm calling the method like this: (and have #import "UIView+Trans.h" at the top of each file that uses the category method.) I've also tried casting the UIButton* to a UIView*.

[self.myButton fadeOutWithDuration:kFadeOutDuration];

I've used the "NSString+Reverse" example from this Categories Example article successfully in the same project and without the pesky warnings.

+1  A: 

In your header file, you've declared the category on UIImage not UIView.

Robot K
Wow! I cannot believe how many times I've gone over those lines and missed that! Also interesting that it was working... Thanks so much!
Dave
Cool eye! I didn't see it
vodkhang