Multiple lines in UITabBarItem Label
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
and now play with this label.
Custom UITabBarItem without title label
made same task just today.
Since I can't use full space of tab bar for item image I just change tab bar background when user press any tab.
So the first step is to prepare background images with full size buttons for every tab selected.
Then create custom class and assign it for your tab bar controller
In your custom class set background image for first tab in ViewDidLoad:
[[self tabBar] setBackgroundImage:[UIImage imageNamed:@"tabShopsActive"]];
[[self tabBar] setSelectionIndicatorImage:[UIImage imageNamed:@"tabSelection"]];Add background change for every UIController in ViewWillAppear:
UITabBarController *bar = [self tabBarController];
[bar.tabBar setBackgroundImage:[UIImage imageNamed:@"tabDiscountsActive"]];
So now when user press any tab Tab Bar change background to show correct picture for it.
It is my resulting tab bar when second tab selected:
Related Topics
Prepareforsegue Not Called from Custom UItableviewcell
Uiwindow? Does Not Have Member Named Bounds
Adaptive Launch Screen Storyboards: How to Differentiate iPad Orientations
API Call Error in Xcode 7/iOS 9 (How to Setup App Transport Security in Plist)
Uipageviewcontroller Setviewcontrollers, UIpagecontrol Not Showing Right Current Number
Mkannotation Not Getting Selected in iOS5
Apn Custom Notification Sound Issue
Uitextview - Can't Set Underline or Strikethrough Attributes on Text
Perform "Use Photo" Button on Custom Image Picker Overlay
Best Approach to Change Xib Direction Programmatically
Spritekit Swift Node Count Issues
Sprite Kit Collision Detection
Can You Change The Font Size of a UIdatepicker
Problems with Layout of Some Rows in Swiftui List
How to Integrate .Proto Files in Xcode Compilation
iOS How to Get a List of Already Purchased Products