UIView类别导致无法识别的选择器错误

时间:2013-05-10 20:08:34

标签: iphone ios uiviewanimation objective-c-category

我有一个导致错误的UIView类别,我无法弄清楚这是该类别的.h:

#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

然后我将它导入视图控制器。创建一个新的UIView并使用其中一种方法。当我开始输入时,它建议使用此方法,如果我定义它,它会转到正确的位置。但当我运行它时,它说:

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

有什么想法?让我发疯了。

1 个答案:

答案 0 :(得分:0)

在由于某种原因创建扩展时,扩展未添加到目标。添加它修复了问题。