我的应用程序是使用UIPageViewController的基于页面的应用程序。现在我想能够在我的页面上垂直移动子视图。实现UIPanGestureRecognizer后,我能够移动子视图,但现在我的水平滑动在页面中移动不起作用...
我如何结合这两个手势? 这是我的panGestureRecognizer:
ContentViewController.swift
var panSwipe = UIPanGestureRecognizer(target: self, action: Selector("handlePanSwipe:"))
view.addGestureRecognizer(panSwipe)
...
func handlePanSwipe(sender:UIPanGestureRecognizer) {
var translation = sender.translationInView(self.view)
if sender.state == UIGestureRecognizerState.Began {
startLocation = sender.locationInView(self.view)
} else if (sender.state == UIGestureRecognizerState.Changed) {
self.settingsView.frame.origin.y = self.newSettingsFrameOrigin!.y + translation.y
} else if (sender.state == UIGestureRecognizerState.Ended) {
self.newSettingsFrameOrigin = self.settingsView.frame.origin
}
我希望能够上下移动深绿色子视图:
提前致谢!