iphone - warning: class 'CardController' does not implement the 'UIGestureRecognizerDelegate' protocol -
in app trying detect swipe gesture navigate next page ...
please find below code below
uiswipegesturerecognizer *swiperight = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swiperightaction:)]; swiperight.direction = uiswipegesturerecognizerdirectionright; swiperight.delegate = self; [cardsgridview addgesturerecognizer:swiperight];
when run application, below warning...
warning: class 'mygesture' not implement 'uigesturerecognizerdelegate' protocol
kindly me missing here.
update1 : can pls show me working code detect swipe....
the uigesturerecognizerdelegate
protocol defines optional methods. there 2 ways rid of warning:
- do not set delegate @ if not need of optional delegate methods.
swiperightaction
method call work anyway specify target , selector in initializer. if need set delegate, indicate in header file of delegate class class implements protocol specifying in angle brackets after superclass name:
@interface yourclass : uiviewcontroller <uigesturerecognizerdelegate> { ... }
edit: thanks, forgot escape angle brackets.
Comments
Post a Comment