Multiple lines in UITabBarItem Label

前端 未结 4 1784
说谎
说谎 2021-01-19 12:06

I\'ve tried many things but impossible to find a way to put the label of a UITabBarItem with a lineNumber customised.0 (i would like to get the title on 2 lines).

Is

4条回答
  •  爱一瞬间的悲伤
    2021-01-19 12:38

    More stable solution:

    guard let view = tabBarItem?.value(forKey: "view") as? UIView,
            let label = (view.subviews.flatMap{ $0 as? UILabel }).first,
            let imageView = (view.subviews.flatMap{ $0 as? UIImageView }).first else { return }
    

提交回复
热议问题