Tag: 滑动手势

Swift:在视图之间用滑动手势进行分段控制

我正在使用UIContainer在使用分段控制+轻扫手势的视图之间切换。 我的故事板是这样的。 Override func viewDidLoad() { super.viewDidLoad() var swipeRight = UISwipeGestureRecognizer(target: self, action: "respondToSwipeGesture:") swipeRight.direction = UISwipeGestureRecognizerDirection.Right self.view.addGestureRecognizer(swipeRight) } 我厌倦了Github的许多开源资源,但它是用Objective-C编写的? 任何人都可以帮忙

识别UIView中的滑动手势,使用手势识别器滚动scrollView

我有UIScrollView和滚动视图框架不等于UIView框架。 因此,在滚动视图框之外滑动时,滚动视图内容不会被刷新。 但是我希望整个屏幕响应滚动视图,尽pipe滚动视图不能覆盖整个屏幕。 我知道可以通过使滚动视图框架等于视图框架来完成。但我不想这样做。 我尝试了迄今为止发现的其他可能解决scheme。 但没有任何工作,因为我想。 我需要使用手势识别器来做到这一点。 以下是我的代码: override func viewDidLoad() { super.viewDidLoad() scrollView.delegate = self let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture)) swipeRight.direction = UISwipeGestureRecognizerDirection.right self.view.addGestureRecognizer(swipeRight) let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture)) swipeLeft.direction = UISwipeGestureRecognizerDirection.left self.view.addGestureRecognizer(swipeLeft) } func respondToSwipeGesture(gesture: UIGestureRecognizer) { if let swipeGesture = gesture as? UISwipeGestureRecognizer { switch swipeGesture.direction { case […]

向左或向右滑动以加载具有集合视图单元格高亮显示的视图控制器

我有3个视图控制器称为firstvc, secondvc, thirdvc 。 我有一个水平滚动的集合视图。 如果我select我的first cell我的firstvc在我的子视图显示在我的mainviewcontroller 。 它同样也是2, 3rd cell 。 没关系 。 现在我需要一个function,如果我滑动我的subview ,将有我所有的视图控制器时,我select任何单元格。 我需要添加左右滑动。 例如 : 如果我在firstvc那么我的first cell将被选中 。 现在,如果我滑动我的subview ,我的secondvc必须来意味着,而我的第二个集合视图单元格也必须highlight 我不知道如何涂抹。 我的代码: @IBOutlet weak var collectionview: UICollectionView! @IBOutlet weak var contentSubView: UIView! func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return self.items.count } // make a cell for each […]

是否有可能通过编程禁用iOS 7中的控制中心,如果没有,有什么替代scheme?

我开发了一个应用程序,从下到上使用滑动手势。 它在iOS 6中运行得非常好,但是现在iOS 7已经出来了,它的工作原理可能是25次中的1次:我几乎每次都能得到iOS 7控制中心。 显然,控制中心可以在设置中被禁用,但这是由电话的所有者,我无法控制。 所以我的问题是,有没有办法禁用控制中心的时候,当我的应用程序正在运行(或更有可能,是“积极”,因为我想控制中心回来,如果用户不积极使用我的应用程序)。 如果不是,还有什么select? 重新定位/重构function是唯一的解决scheme吗?