MenuItem.m 509 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // MenuItem.m
  3. // CommonLibrary
  4. //
  5. // Created by Alexi on 14-1-16.
  6. // Copyright (c) 2014年 CommonLibrary. All rights reserved.
  7. //
  8. #import "MenuItem.h"
  9. @implementation MenuItem
  10. - (instancetype)initWithTitle:(NSString *)title icon:(UIImage *)icon action:(MenuAction)action
  11. {
  12. if (self = [super init])
  13. {
  14. self.title = title;
  15. self.icon = icon;
  16. self.action = action;
  17. }
  18. return self;
  19. }
  20. - (void)menuAction
  21. {
  22. if (_action)
  23. {
  24. _action(self);
  25. }
  26. }
  27. @end