我有 TabBarController,它有自定义中心按钮 (UIButton)。这里的目标是在用户从其他 ViewController 返回到 TabBarController 时为其不透明度设置动画。
所以我想要实现的是开始将中心按钮的不透明度设置为从 0 到 1 的动画,具体取决于用户滑动的“距离”。
我正在使用 interactivePopGestureRecognizer
,因此检测边缘“进度”的滑动对于我的情况来说是理想的。
或者还有其他方法吗?也许检测 topViewController 可见性?
最佳答案
我刚刚通过添加自定义目标解决了这个问题
self.navigationController?.interactivePopGestureRecognizer?.addTarget(self, action: #selector(CountdownsViewController.handlePopGesture))
然后
@objc func handlePopGesture ()
{
viewtoanimate.alpha = self.transitionCoordinator!.percentComplete
}
关于ios - UINavigationController - 获取交互式弹出手势识别器进度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42651618/