ios - UISwipeGestureRecognizer isn't sent to an IBAction method when swiping in the simulator -



ios - UISwipeGestureRecognizer isn't sent to an IBAction method when swiping in the simulator -

i dragged 2 swipe gestures image view in view controller, 1 right swipe , left. hooked both of them view controller's header file ibaction. wrote codes in ibaction method problem never called when swipe left/right while running app. here sample of code:

class="lang-c prettyprint-override">- (ibaction)handleswipe:(uiswipegesturerecognizer *)sender { nslog(@"swiped"); nsarray *images; if (self.selectedrow == 0) { images = [[nsarray alloc] initwithobjects:@"w8.jpg",@"w7.jpg",@"w6.jpg",@"w5.jpg",@"w4.jpg",@"w3.jpg", @"w2.jpg", @"w1.jpg" ,@"w9.jpg", nil]; uiswipegesturerecognizerdirection direction = [(uiswipegesturerecognizer *) sender direction]; switch (direction) { case uiswipegesturerecognizerdirectionright: imageindex++; break; case uiswipegesturerecognizerdirectionleft: imageindex--; break; default: break; } imageindex = (imageindex < 0) ? ([images count] - 1): imageindex % [images count]; self.imageview.image = [uiimage imagenamed:[images objectatindex:imageindex]]; } }

the nslog has never been shown, sure sender not sent method. thing used run same code in xcode 5 , ok, have updated xcode version 6. should prepare issue?

i found problem was. in image view's attribute inspector, "user interaction enabled" unchecked, enabled it. swipe gesture works fine.

ios objective-c xcode

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -