我希望能够通过在当前视图控制器上捏视图来导航到另一个视图控制器。
控制台显示视图正在识别捏合手势并将其记录下来。
但是我不清楚如何触发捏打开另一个 ViewController。
这是我用来实现它的代码。
- (void)viewDidLoad
{
[super viewDidLoad];
//Pinch Gesture
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
[self.view addGestureRecognizer:pinchGesture];
}
- (IBAction)handlePinchGesture:(UIPinchGestureRecognizer *)sender
{
NSLog(@" ((UIPinchGestureRecognizer *) sender).scale %f", ((UIPinchGestureRecognizer *) sender).scale);
if (((UIPinchGestureRecognizer *)sender).scale > 1.0)
{
//I tried to use a different method to instantiate AustraliaViewController but it //doesn't work
//[self.storyboard instantiateViewControllerWithIdentifier:@"Australia"];
AustraliaViewController *aust = [[AustraliaViewController alloc] initWithNibName:@"Australia" bundle:Nil];
aust.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:aust animated:YES completion:Nil];
}
[self showInfo:(id)sender];
}