PhotoStackView.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // PhotoStackView.h
  3. //
  4. // Created by Tom Longo on 16/08/12.
  5. // - Twitter: @tomlongo
  6. // - GitHub: github.com/tomlongo
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class PhotoStackView;
  10. @protocol PhotoStackViewDataSource <NSObject>
  11. @required
  12. - (NSUInteger)numberOfPhotosInPhotoStackView:(PhotoStackView *)photoStack;
  13. - (UIImage *)photoStackView:(PhotoStackView *)photoStack photoForIndex:(NSUInteger)index;
  14. @optional
  15. - (CGSize)photoStackView:(PhotoStackView *)photoStack photoSizeForIndex:(NSUInteger)index;
  16. @end
  17. @protocol PhotoStackViewDelegate <NSObject>
  18. @optional
  19. -(void)photoStackView:(PhotoStackView *)photoStackView willStartMovingPhotoAtIndex:(NSUInteger)index;
  20. -(void)photoStackView:(PhotoStackView *)photoStackView willFlickAwayPhotoFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
  21. -(void)photoStackView:(PhotoStackView *)photoStackView didRevealPhotoAtIndex:(NSUInteger)index;
  22. -(void)photoStackView:(PhotoStackView *)photoStackView didSelectPhotoAtIndex:(NSUInteger)index;
  23. @end
  24. @interface PhotoStackView : UIControl <UIGestureRecognizerDelegate>
  25. @property (weak, nonatomic) id <PhotoStackViewDataSource> dataSource;
  26. @property (weak, nonatomic) id <PhotoStackViewDelegate> delegate;
  27. // The image to use for the border (default is white rounded corner)
  28. @property (nonatomic, strong) UIImage *borderImage;
  29. // When set to YES a white border will appear around photos (default is YES)
  30. @property (nonatomic) BOOL showBorder;
  31. // Inset width used for the border image (Default is 5.0)
  32. @property (nonatomic) CGFloat borderWidth;
  33. // How many degrees each photo in the stack could be rotated (Default is 4.0)
  34. // eg. 5.0 will randomly rotate each photo from -5 to +5 degrees
  35. @property (nonatomic) CGFloat rotationOffset;
  36. // The overlay colour that appears when the user taps on a photo
  37. // (default is black at 0.15 alpha)
  38. @property (nonatomic, strong) UIColor *highlightColor;
  39. -(NSUInteger)indexOfTopPhoto;
  40. -(void)goToPhotoAtIndex:(NSUInteger)index;
  41. -(void)hidePhotoAtIndex:(NSUInteger)index;
  42. -(void)flipToNextPhoto;
  43. -(void)reloadData;
  44. @end