PSTCollectionViewCell.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // PSTCollectionViewCell.h
  3. // PSPDFKit
  4. //
  5. // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved.
  6. //
  7. #import "PSTCollectionViewCommon.h"
  8. @class PSTCollectionViewLayout, PSTCollectionView, PSTCollectionViewLayoutAttributes;
  9. @interface PSTCollectionReusableView : UIView
  10. @property (nonatomic, readonly, copy) NSString *reuseIdentifier;
  11. // Override in subclasses. Called before instance is returned to the reuse queue.
  12. - (void)prepareForReuse;
  13. // Apply layout attributes on cell.
  14. - (void)applyLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes;
  15. - (void)willTransitionFromLayout:(PSTCollectionViewLayout *)oldLayout toLayout:(PSTCollectionViewLayout *)newLayout;
  16. - (void)didTransitionFromLayout:(PSTCollectionViewLayout *)oldLayout toLayout:(PSTCollectionViewLayout *)newLayout;
  17. @end
  18. @interface PSTCollectionReusableView (Internal)
  19. @property (nonatomic, unsafe_unretained) PSTCollectionView *collectionView;
  20. @property (nonatomic, copy) NSString *reuseIdentifier;
  21. @property (nonatomic, strong, readonly) PSTCollectionViewLayoutAttributes *layoutAttributes;
  22. @end
  23. @interface PSTCollectionViewCell : PSTCollectionReusableView
  24. @property (nonatomic, readonly) UIView *contentView; // add custom subviews to the cell's contentView
  25. // Cells become highlighted when the user touches them.
  26. // The selected state is toggled when the user lifts up from a highlighted cell.
  27. // Override these methods to provide custom UI for a selected or highlighted state.
  28. // The collection view may call the setters inside an animation block.
  29. @property (nonatomic, getter=isSelected) BOOL selected;
  30. @property (nonatomic, getter=isHighlighted) BOOL highlighted;
  31. // The background view is a subview behind all other views.
  32. // If selectedBackgroundView is different than backgroundView, it will be placed above the background view and animated in on selection.
  33. @property (nonatomic, strong) UIView *backgroundView;
  34. @property (nonatomic, strong) UIView *selectedBackgroundView;
  35. @end