Open Nipagohel opened 5 years ago
May be a little late but this is how I did this: I created an xib and set the controller.navigationItem.titleView as this view. The library will take the titleView and set it as the tab's custom view.
var tabView = SegmentedTabView() . // segmented tab view is the class for the view that i used for the titleView.
if let customTabView = (Bundle.main.loadNibNamed("SegmentedTabView", owner: nil, options: nil) as? [SegmentedTabView])?.first {
tabView = customTabView
tabView.image.image = UIImage(named: "About-Me")
tabView.label.text = "About Me"
}
interestsViewController.navigationItem.titleView = tabView
This way you can create any custom view for the tab.
Another way can be:
The tab has a UIButton, so u can create an initialiser in the SJSegmentTab.swift file, and set the title and image of the button there.
How i set the image and title on the segmented tab bar ?
image and title side by side