Hi,
I have an label as cutomView toolbarItem. I want to change it's string value from ViewControllers.
Any suggestions, how to do it?
Hi,
I have an label as cutomView toolbarItem. I want to change it's string value from ViewControllers.
Any suggestions, how to do it?
Yes. I solved it. Thanks
I creaed an outlet of toolBarItem from IB inspector & it's working now.
You have probably created the toolBar in IB.
So, you can have an IBOutlet connected to the toolBar.
@IBOutlet weak var tabBarCustom: UIToolbar!
To change the title :
tabBarCustom.items?[0].title = "New name"
Note: that's for IOS.
On OSX, you can use similar solution (class is NSToolBar)
tabBarCustom.items?[0].label = "New name"
Hi Claude,
I'm using OSX. I have a toolbar which contains NSTextField as Custom Views.
tabBarCustom.items?[0].label = "New name"
This works when using Icon & Text. I want to use Icon only Toolbar.
Could you give more details ?
This works when using Icon & Text.
In the toolbarItem, In the attributes inspector, you have:
- image
- label ==> This is the one you change with
tabBarCustom.items?[0].label = "New name"
- palette label
I want to use Icon only Toolbar.
What do you mean ?
Is it a toolbar where label is empty ? Or something else ?
You ask: I want to change it's string value from ViewControllers.
What do you want to change ? The label ? Something else ?
Did you solve your issue ?
Yes. I solved it. Thanks
I creaed an outlet of toolBarItem from IB inspector & it's working now.