gpt4 book ai didi

ios - 如何在 iOS7 中不启动方法

转载 作者:行者123 更新时间:2023-11-28 11:20:28 25 4
gpt4 key购买 nike

只有当 >= 8.0 时,我才能开始下面的方法?它在 TabBarController 类中。

let floatVersion = (UIDevice.currentDevice().systemVersion as NSString).floatValue

func tabBarController(tabBarController: UITabBarController, animationControllerForTransitionFromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
// if ( floatVersion >= 8.0) {

let transitioningObject: TransitioningObject = TransitioningObject()
transitioningObject.tabBarController = self
return transitioningObject
//}
}

最佳答案

由于您的方法返回可选的 UIViewControllerAnimatedTransitioning,如果版本低于 8.0,您可以返回 nil

func tabBarController(tabBarController: UITabBarController, animationControllerForTransitionFromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if ( floatVersion >= 8.0) {

let transitioningObject: TransitioningObject = TransitioningObject()
transitioningObject.tabBarController = self
return transitioningObject
}else{
return nil
}
}

关于ios - 如何在 iOS7 中不启动方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28612184/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com