以下のコードでシェイクジェスチャをキャッチする方法はすでに知っています
- (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 は、揺れを受信したことを示しています
ただし、別のビューをプッシュする方法、または最後のビューに戻る方法については、以下のコードは View クラスではなく ViewController クラスでのみ使用できることがわかっているため、この Leavesview は LeavesviewController によって処理され、別の PDFViewController でこの viewController を使用して表示します。では、どうすれば別のビューにジャンプしたり、元に戻したりできますか???
UIViewController *myView = [[UIViewController alloc]init];
[self.navigationController pushViewController:myView animated:YES];