MMPopupItem.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // MMActionItem.h
  3. // MMPopupView
  4. //
  5. // Created by Ralph Li on 9/6/15.
  6. // Copyright © 2015 LJC. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. typedef void(^MMPopupItemHandler)(NSInteger index);
  11. @interface MMPopupItem : NSObject
  12. @property (nonatomic, assign) BOOL highlight;
  13. @property (nonatomic, assign) BOOL disabled;
  14. @property (nonatomic, strong) NSString *title;
  15. @property (nonatomic, strong) UIColor *color;
  16. @property (nonatomic, copy) MMPopupItemHandler handler;
  17. @end
  18. typedef NS_ENUM(NSUInteger, MMItemType) {
  19. MMItemTypeNormal,
  20. MMItemTypeHighlight,
  21. MMItemTypeDisabled
  22. };
  23. NS_INLINE MMPopupItem* MMItemMake(NSString* title, MMItemType type, MMPopupItemHandler handler)
  24. {
  25. MMPopupItem *item = [MMPopupItem new];
  26. item.title = title;
  27. item.handler = handler;
  28. switch (type)
  29. {
  30. case MMItemTypeNormal:
  31. {
  32. break;
  33. }
  34. case MMItemTypeHighlight:
  35. {
  36. item.highlight = YES;
  37. break;
  38. }
  39. case MMItemTypeDisabled:
  40. {
  41. item.disabled = YES;
  42. break;
  43. }
  44. default:
  45. break;
  46. }
  47. return item;
  48. }