Tabbar items text override in large localization strings. I tried below solution and other possible solution but its not working fine. In below solution if number of lines is 2 than its truncate the string properly and don't override but if number of lines is 1 then its override and don't truncate the string properly. Please help to provide any feasible solution, Thanks in advance.
// acess to list of tab bar items
if let items = self.tabBar.items {
items.indices.forEach{
let viewTabBar = items[$0].value(forKey: "view") as? UIView
let label = viewTabBar?.subviews[1]as? UILabel
label?.numberOfLines = 1
label?.lineBreakMode = .byTruncatingTail
if $0 == 0{
label?.text = Messages.shared.OPERATION.uppercased()
}else if $0 == 1{
label?.text = Messages.shared.ERROR_INFO.uppercased()
}else if $0 == 2{
label?.text = Messages.shared.ENERGY_DATA.uppercased()
}else if $0 == 3{
label?.text = Messages.shared.OVERVIEW.uppercased()
}
}
}