Reputation: 2510
I have created a subclass
of UIToolbar
. And setting toolbar items
from that class
. On ViewController
, i took a toolbar
and assign it a class subclass
of UIToolbar
. Its showing toolbar items
on it.
The problem is that, when i update toolbar items
its not showing on viewController
. When i go to another view
and come to this view
its showing updated toolbar items
.
I need an immediate refresh of toolbar items
on that viewController
.
Upvotes: 2
Views: 3082
Reputation: 1557
In the viewController that contains your UIToolbar
, call "[self.view setNeedsLayout]" (or even just [self.toolbar setNeedsLayout]
) to force re-drawing of the graphics context.
On a different note, though: You should not need to subclass UIToolbar to just set the toolbar items. Create a UIToolbar
and set its items
array by calling [self.myToolbar setItems:@[item1, item2, ...]]
Upvotes: 4