-1
我目前正試圖通過向左滑動來連接不同的ViewControllers,但是,我的代碼不適合我。我加輕掃手勢識別到ViewController在stroyboard文件 這是我的代碼在ViewController與故事板之間滑動
UISwipeGestureRecognizer *swipeLeftGesture=[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
[self.view addGestureRecognizer:swipeLeftGesture];
swipeLeftGesture.direction=UISwipeGestureRecognizerDirectionLeft;
}
-(void)handleSwipeGesture:(UIGestureRecognizer *) sender
{
NSUInteger touches = sender.numberOfTouches;
if (touches == 2)
{
if (sender.state == UIGestureRecognizerStateEnded)
{
//Add view controller here
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone6" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self presentViewController:vc animated:YES completion:nil];
}
}
}
感謝您的幫助! – user1569766
當然!祝你好運!如果你能夠讓我的答案被接受,那麼它會很棒。 –
我需要15點聲望 – user1569766