spicyShrimp/U17

在TabbarController下的控制器中添加轮播控件,从左向右划时崩溃

LockLight opened this issue · 2 comments

首先非常感谢分享Demo,目前看到的结构最清晰的swift4 Demo.

下面描述一下我的问题,崩溃信息如下,

UNavigationController 0x7fee7d04f600> valueForUndefinedKey:]: this class is not key value coding-compliant for the key __isTransitioning.'

使用了项目中的UNavigationController基类,应该是轮播的左划与导航栏的左划返回手势冲突,注释下面的extension后不会崩溃了,请问有什么更好的处理办法吗

`extension UINavigationController:UIGestureRecognizerDelegate{

public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
    let isLeftToRight = UIApplication.shared.userInterfaceLayoutDirection == .leftToRight
    guard let ges = gestureRecognizer as? UIPanGestureRecognizer else {
        return true
    }
    if ges.translation(in: gestureRecognizer.view).x * (isLeftToRight ? 1 : -1) <= 0
        || value(forKey: "__isTransitioning") as! Bool
        || disablePopGesture{
        return false
    }
    return viewControllers.count != 1
}

}`

this class is not key value coding-compliant for the key __isTransitioning.'

swift下找不到这个key了 把这个||删除就可以了
if ges.translation(in: gestureRecognizer.view).x * (isLeftToRight ? 1 : -1) <= 0
|| disablePopGesture{
return false
}