FLEXExplorerToolbarItem.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // FLEXExplorerToolbarItem.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 4/4/14.
  6. // Copyright (c) 2020 FLEX Team. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface FLEXExplorerToolbarItem : UIButton
  11. + (instancetype)itemWithTitle:(NSString *)title image:(UIImage *)image;
  12. /// @param backupItem a toolbar item to use in place of this item when it becomes disabled.
  13. /// Items without a sibling item exhibit expected behavior when they become disabled, and are greyed out.
  14. + (instancetype)itemWithTitle:(NSString *)title image:(UIImage *)image sibling:(nullable FLEXExplorerToolbarItem *)backupItem;
  15. /// If a toolbar item has a sibling, the item will replace itself with its
  16. /// sibling when it becomes disabled, and vice versa when it becomes enabled again.
  17. @property (nonatomic, readonly) FLEXExplorerToolbarItem *sibling;
  18. /// When a toolbar item has a sibling and it becomes disabled, the sibling is the view
  19. /// that should be added to or removed from a new or existing toolbar. This property
  20. /// alleviates the programmer from determining whether to use \c item or \c item.sibling
  21. /// or \c item.sibling.sibling and so on. Yes, sibling items can also have siblings so
  22. /// that each item which becomes disabled may present another item in its place, creating
  23. /// a "stack" of toolbar items. This behavior is useful for making buttons which occupy
  24. /// the same space under different states.
  25. ///
  26. /// With this in mind, you should never access a stored toolbar item's view properties
  27. /// such as \c frame or \c superview directly; you should access them on \c currentItem.
  28. /// If you are trying to modify the frame of an item, and the item itself is not currently
  29. /// displayed but instead its sibling is being displayed, then your changes could be ignored.
  30. ///
  31. /// @return the result of the item's sibling's \c currentItem,
  32. /// if this item has a sibling and this item is disabled, otherwise this item.
  33. @property (nonatomic, readonly) FLEXExplorerToolbarItem *currentItem;
  34. @end
  35. NS_ASSUME_NONNULL_END