UITabBarItem标签中的多行 [英] Multiple lines in UITabBarItem Label
本文介绍了UITabBarItem标签中的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试了很多事情,但是找不到一种方法来将UITabBarItem的标签与lineNumber customized.0(我希望在两行上获得标题)联系起来.
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).
有办法吗?
推荐答案
现在它包含两个子视图.在0处是imageView,在1处是label.
现在,将imageview
的高度减小一些,以便可以将标签的高度增大以具有多行.通过代码将标签的属性ofnumberoflines
设置为0.
Now it contains two subviews. At 0 it is imageView and at 1 it is label.
Now make the height of imageview
a bit smaller so that you can give the height of label a bit larger to have multiple lines. Set the property ofnumberoflines
of the label to 0 via code.
let viewTabBar = tabBarItem.value(forKey: "view") as? UIView
let imageView = viewTabBar?.subviews[0] as? UIImageView
let label = viewTabBar?.subviews[1] as? UILabel
现在使用此标签.
这篇关于UITabBarItem标签中的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文