Skip to content
This repository was archived by the owner on Dec 13, 2017. It is now read-only.

Commit 222d3ea

Browse files
committed
Merge pull request #745 from bagia/btnproperties
Expose a way to make visible or hidden a toolbar item
2 parents 6a78ee6 + 90d690f commit 222d3ea

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

Classes/WPEditorFormatbarView.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ typedef enum
139139

140140
#pragma mark - Toolbar items
141141

142+
/**
143+
* @brief Makes a toolbar item visible or hidden
144+
*
145+
* @param tag WPEditorViewControllerElementTag of the item to alter.
146+
* @param visible YES to make the item visible, NO to hide it.
147+
*/
148+
- (void)toolBarItemWithTag:(WPEditorViewControllerElementTag)tag setVisible:(BOOL)visible;
149+
142150
/**
143151
* @brief Enables and disables the toolbar items.
144152
*

Classes/WPEditorFormatbarView.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ - (void)setSelectedItemTintColor:(UIColor *)selectedItemTintColor
189189

190190
#pragma mark - Toolbar items
191191

192+
- (void)toolBarItemWithTag:(WPEditorViewControllerElementTag)tag setVisible:(BOOL)visible
193+
{
194+
for (ZSSBarButtonItem *item in self.leftToolbar.items) {
195+
if (item.tag == tag) {
196+
item.customView.hidden = !visible;
197+
}
198+
}
199+
200+
for (ZSSBarButtonItem *item in self.regularToolbar.items) {
201+
if (item.tag == tag) {
202+
item.customView.hidden = !visible;
203+
}
204+
}
205+
}
206+
192207
- (void)enableToolbarItems:(BOOL)enable
193208
shouldShowSourceButton:(BOOL)showSource
194209
{

0 commit comments

Comments
 (0)