Getting the frame of a particular tab bar item

前端 未结 12 1017
礼貌的吻别
礼貌的吻别 2021-02-02 07:42

Is there a way to find the frame of a particular UITabBarItem in a UITabBar?

Specifically, I want to create an animation of an image \"falling\

12条回答
  •  生来不讨喜
    2021-02-02 07:45

    When initializing a tab bar, give it a tag:

    let tabItem = UITabBarItem(title: "my title", image: nil, tag: 1000)

    Then you can fetch the tab bar using:

    let myTabItem = tabBarController?.tabBar.viewWithTag(1000)

提交回复
热议问题