So I'm using the C4 coding framework for IOS and I've encountered something I can't quite figure out.
I'm using two examples for the C4 github account together - the testScrollView and WalkCycle examples.
I have a C4View subclass called Walker which uses the WalkCycle example as a the template for a small animated character. This character is placed into a scrollable view created from the testScrollView example. He's got a pan gesture added so that the user can drag him to the top of the screen, and watch him fall and splat on the bottom.
Only problem is I can't get any kind of method called when the pan gesture is ended, not from the -(void)touchesEnded command and not from others I've tried.
Some links to similar problems that haven't helped me but might help someone else work this out:
- Detecting Pan Gesture End
- Number of touches in PAN gesture is not working
- UIViewController not responding properly to gestures...
My totally uneducated and baseless hunch is that it has something to do with the walker being a child of C4View, as I didn't have this problem recognizing touchesEnded with c4shapes and images.
I'm not really sure what to post for code, but here are the relevant bits from Walker.m;
-(void)setup {
walkA = [C4Image animatedImageWithNames:@[@"beaviswalk1.tiff",
@"beaviswalk2.tiff",
@"beaviswalk3.tiff",
@"beaviswalk4.tiff",
@"beaviswalk5.tiff",
@"beaviswalk6.tiff",
@"beaviswalk7.tiff",
@"beaviswalk8.tiff",
@"beaviswalk9.tiff",
]];
[self addImage:walkA];
currentImage = walkA;
[walkA play];
mover = [C4Timer automaticTimerWithInterval:0.05f target:self method:@"walking" repeats:YES];
[self addGesture:TAP name:@"tapGesture" action:@"trip"];
[self addGesture:PAN name:@"panGesture" action:@"move:"];}
and touchesEnded:
-(void)touchesEnded {
C4Log(@"touches Ended");
}
and looking at Walker.h I just realized something strange;
#import "C4View.h"
@interface Walker : C4Image
-(id)initWithFrame:(CGRect)frame;
-(void)play;
-(void)switchWalkCycle;
-(void)trip;
-(void)bleed;
-(void)walking;
-(void)touchesEnded;
-(void)noTouching;
@end
I changed the @interface to C4Image at some point, at the time it seemed to effect nothing and allowed me to have TAP and PAN gestures that worked. Until now....Changing it back to a C4View eliminates support for all gestures. I imagine the problem is there?
Apologies if there is a simple solution but I'm quite lost in trying to fix this.