iphone - 使用滑动手势查看导航

标签 iphone ios xcode ipad

如何使用滑动手势垂直切换 View ?

最佳答案

我找到了答案。我正在发布代码供您引用。谢谢:-)

viewDidLoad

  UISwipeGestureRecognizer *swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedScreendown:)] autorelease];
  swipeGesture.numberOfTouchesRequired = 1;
  swipeGesture.direction = UISwipeGestureRecognizerDirectionDown;
  [m_pImageView addGestureRecognizer:swipeGesture];

现在

- (void)swipedScreendown:(UISwipeGestureRecognizer*) swipeGesture {
  m_pViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
  CATransition *transition = [CATransition animation];
  transition.duration = 0.75;
  transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  transition.type = kCATransitionPush;
  transition.subtype = kCATransitionFromBottom;
  transition.delegate = self;
  [self.view.layer addAnimation:transition forKey:nil];
  [self.view addSubview:PadViewController.view];
}

如果您需要更多说明,请在此处发帖。

关于iphone - 使用滑动手势查看导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6326816/

相关文章:

iphone - 将 UIViewController xib 加载到 Storyboard 中的 ContainerView

iphone - 如果可能的话,如何从网站添加指向 iPhone native 应用程序的链接

iphone - 检测 UIAlert/通知

ios - 是否可以强制 AVPlayer 停止在外部播放视频(在 Apple TV 上)

ios - 如何暂停我的应用程序足够长的时间以使我的屏幕显示为 "catch up"

ios - 多次触发 ALAssetLibraryChangedNotification

iPhone Google Chrome - 选项卡选择屏幕(分组的 UIViews)

xcode - SQLite.swift 构建错误 "Module file' s 最小部署目标是 ios8.3 v8.3”

python - 通过命令行将文件添加到 Xcode 项目?在 Xcode 中使用 project.pbxproj 文件?

iphone - 如何从十六进制 NSString 获取十进制整数