首页 > 解决方案 > 如何使用 Swift 在 UITabbar 第一个项目上添加自定义标签

问题描述

我的场景,我需要在 UITabbar 第一项中心位置添加一个自定义标签,因为基于标签中心位置,我将在其上应用圆形过渡起点。

我的代码如下

func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        transition.transitionMode = .present
        transition.startingPoint = customLabel.center // here I need to get custom label center position 
        return transition
    }

func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        transition.transitionMode = .dismiss
        transition.startingPoint =  customLabel.center
        return transition
    }

标签: swift

解决方案


推荐阅读