我已经知道如何使用下面的代码来捕捉摇晃手势
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if ( event.subtype == UIEventSubtypeMotionShake )
{
// Put in code here to handle shake
NSLog(@"Device Shaked");
}
if ( [super respondsToSelector:@selector(motionEnded:withEvent:)] )
[super motionEnded:motion withEvent:event];
}
NSLog 显示它确实收到了震动
但是如何推送另一个视图,或者返回上一个视图,因为我们知道下面的代码只能在 ViewController 类而不是 View 类中使用,这个 Leavesview 由一个 LeavesviewController 处理,我在另一个 PDFViewController 中使用这个 viewController 来显示,那么我怎样才能让它跳转到另一个视图或驳回???
UIViewController *myView = [[UIViewController alloc]init];
[self.navigationController pushViewController:myView animated:YES];