SWTableViewCell.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // SWTableViewCell.h
  3. // SWTableViewCell
  4. //
  5. // Created by Chris Wendel on 9/10/13.
  6. // Copyright (c) 2013 Chris Wendel. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <UIKit/UIGestureRecognizerSubclass.h>
  10. #import "SWCellScrollView.h"
  11. #import "SWLongPressGestureRecognizer.h"
  12. #import "SWUtilityButtonTapGestureRecognizer.h"
  13. #import "NSMutableArray+SWUtilityButtons.h"
  14. @class SWTableViewCell;
  15. typedef NS_ENUM(NSInteger, SWCellState)
  16. {
  17. kCellStateCenter,
  18. kCellStateLeft,
  19. kCellStateRight,
  20. };
  21. @protocol SWTableViewCellDelegate <NSObject>
  22. @optional
  23. - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index;
  24. - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index;
  25. - (void)swipeableTableViewCell:(SWTableViewCell *)cell scrollingToState:(SWCellState)state;
  26. - (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell;
  27. - (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state;
  28. - (void)swipeableTableViewCellDidEndScrolling:(SWTableViewCell *)cell;
  29. @end
  30. @interface SWTableViewCell : UITableViewCell
  31. @property (nonatomic, copy) NSArray *leftUtilityButtons;
  32. @property (nonatomic, copy) NSArray *rightUtilityButtons;
  33. @property (nonatomic, weak) id <SWTableViewCellDelegate> delegate;
  34. - (void)setRightUtilityButtons:(NSArray *)rightUtilityButtons WithButtonWidth:(CGFloat) width;
  35. - (void)setLeftUtilityButtons:(NSArray *)leftUtilityButtons WithButtonWidth:(CGFloat) width;
  36. - (void)hideUtilityButtonsAnimated:(BOOL)animated;
  37. - (void)showLeftUtilityButtonsAnimated:(BOOL)animated;
  38. - (void)showRightUtilityButtonsAnimated:(BOOL)animated;
  39. - (BOOL)isUtilityButtonsHidden;
  40. @end