Hi I have a question about UISwipeGestureRecognizer. Below is code for swipe, it works fine but not quite how I'd like it. My onPlay action contains an if statement, I would like the swipeUp gesture to only work for one of the if statements, and the swipeDown to work for the other case of the if statement. I.e swipe up to start an animation and swipe down to stop it Is there any way of this working? I would be greatly for help.
UISwipeGestureRecognizer *swipeUp =[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(onPlay)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
[self.view addGestureRecognizer:swipeUp];
[swipeUp release];
UISwipeGestureRecognizer *swipeDown =[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(onPlay)];
swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:swipeDown];
[swipeDown release];
EDIT:
-(IBAction)onPlay:(BOOL)isServer
{
[btnPlay setTitle:@"PLAY" forState:UIControlStateNormal];
if (isServer)
{
[btnPlay setHidden:false];
[btnOpen setHidden:false];
[btnSend setHidden:false];
[lblConnectedPeers setHidden:false];
[lblConnectedPeersCnt setHidden:false];
[m_communication SetConnectionMode:SERVER_CONNECTION];
m_isServer = true;
[m_pPlayer SetType:SERVER];
}
else {
[btnPlay setHidden:true];
[btnOpen setHidden:true];
[btnSend setHidden:true];
[lblConnectedPeers setHidden:true];
[lblConnectedPeersCnt setHidden:true];
[m_communication SetConnectionMode:CLIENT_CONNECTION];
[m_communication StartPeer];
m_isServer = false;
[m_pPlayer SetType:CLIENT];
}
[self ShowConnectionInfo:nil];
}