当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - UIView Category causing unrecognized selector error

问题描述:

I have a UIView Category that is causing an error that I cannot figure out this is the .h for the category:

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, BCRectEdge) {

BCRectEdgeTop = 0,

BCRectEdgeLeft = 1,

BCRectEdgeBottom = 2,

BCRectEdgeRight = 3

};

@interface UIView (Genie)

/*

* After the animation has completed the view's transform will be changed to match the destination's rect, i.e.

* view's transform (and thus the frame) will change, however the bounds and center will *not* change.

*/

- (void)genieInTransitionWithDuration:(NSTimeInterval)duration

destinationRect:(CGRect)destRect

destinationEdge:(BCRectEdge)destEdge

completion:(void (^)())completion;

/*

* After the animation has completed the view's transform will be changed to CGAffineTransformIdentity.

*/

- (void)genieOutTransitionWithDuration:(NSTimeInterval)duration

startRect:(CGRect)startRect

startEdge:(BCRectEdge)startEdge

completion:(void (^)())completion;

@end

And then it I import it into a view controller. Create a new UIView and use one of those methods. It suggests this method as I start typing, and if I define it, it goes to the right place. But when I run it, it says:

'-[UIView genieInTransitionWithDuration:destinationRect:destinationEdge:completion:]: unrecognized selector sent to instance 0x1552c220'

Any thoughts? Driving me crazy.

网友答案:

The extension didn't get added to the target when it was created for some reason. Adding it fixed the issue.

分享给朋友:
您可能感兴趣的文章:
随机阅读: