I know this question seems to be already asked and answered but I can't resolve my issue.
I want to move the objects of my view to follow horizontal slides of a finger (going to previous or next page)
For this, I use TouchesBegan, TouchesMoved and TouchesEnded methods.
It works fine when the touches began on the view background but does not work when touches began on uibuttons.
To solve the problem, I have subclassed the uibuttons which i want to allow the gesture and it was working fine when i was on xCode 3.x and iOS 4.x
Today I just installed OSX Moutain Lion and started to work on xCode 4.4 and iOS 5.1.1 (iPAD). And here I am with the very same app that worked fine and not working anymore.
Here is my UIButton subclass:
// myUIButton.h
#import <UIKit/UIKit.h>
@interface myUIButton : UIButton
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
@end
// myUIButton.m
#import "myUIButton.h"
@implementation myUIButton
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"uibutton touches began");
[self.nextResponder touchesBegan:touches withEvent:event];
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"uibutton touches moved");
[self.nextResponder touchesMoved:touches withEvent:event];
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"uibutton touches ended");
[self.nextResponder touchesEnded:touches withEvent:event];
}
@end
Here are the methods in my main class:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"view touches began");
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"view touches moved");
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"view touches ended");
}
When my touch began on an UIButton I get every NSLog from the subclass but the main touchesMoved is executed only once. (self.nextResponder seems to works only once)
Did something changed that make it not works on xcode 4.4 or iOS 5.1.1 ?
When I first tried to do that (on xcode 3.x and iOS 4.x) i found the solution here: Is there a way to pass touches through on the iPhone?
But it not works anymore...
Could you help me?
Thanks a lot.
EDIT : The problem is the same using [super touches...] instead or in more of [self.nextResponder touches...]