Hi guys,
My main view PlayGameViewController has a subview (actually 2 of them) called CardViewController.
CardViewController creates some buttons programmatically
-(void) initialiseButtons
{
NSLog(@"initialiseButtons %d",totalButtons);
int ypos = playerImage.frame.origin.y + playerImage.frame.size.height + 42;
for(int i=0; i<totalButtons; i++)
{
StatView *sv = [[StatView alloc] initWithYPos:ypos];
sv.tag = 100 + i;
[sv.overlayButton addTarget:self action:@selector(statTapped:)
forControlEvents:UIControlEventTouchUpInside];
sv.overlayButton.tag = 10 + i;
[self.frontView addSubview:sv];
ypos += 26;
}
}
It sets a callback function statTapped. This works ok and the function does get called. But... All the game logic is in PlayGameViewController so I need to handle the function there. I tried deleting the function from CardViewController and implementing it instead in the PlayGameViewController but the call wasn't passed down to the parent class.
Is there away to achieve this or am I talking and thinking crazy?