ASCellNode+Internal.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // ASCellNode+Internal.h
  3. // AsyncDisplayKit
  4. //
  5. // Created by Max Gu on 2/19/16.
  6. //
  7. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  8. // This source code is licensed under the BSD-style license found in the
  9. // LICENSE file in the root directory of this source tree. An additional grant
  10. // of patent rights can be found in the PATENTS file in the same directory.
  11. //
  12. #import "ASCellNode.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. @protocol ASCellNodeInteractionDelegate <NSObject>
  15. /**
  16. * Notifies the delegate that the specified cell node has done a relayout.
  17. * The notification is done on main thread.
  18. *
  19. * This will not be called due to measurement passes before the node has loaded
  20. * its view, even if triggered by -setNeedsLayout, as it is assumed these are
  21. * not relevant to UIKit. Indeed, these calls can cause consistency issues.
  22. *
  23. * @param node A node informing the delegate about the relayout.
  24. * @param sizeChanged `YES` if the node's `calculatedSize` changed during the relayout, `NO` otherwise.
  25. */
  26. - (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged;
  27. /*
  28. * Methods to be called whenever the selection or highlight state changes
  29. * on ASCellNode. UIKit internally stores these values to update reusable cells.
  30. */
  31. - (void)nodeSelectedStateDidChange:(ASCellNode *)node;
  32. - (void)nodeHighlightedStateDidChange:(ASCellNode *)node;
  33. @end
  34. @interface ASCellNode ()
  35. @property (nonatomic, weak) id <ASCellNodeInteractionDelegate> interactionDelegate;
  36. /*
  37. * Back-pointer to the containing scrollView instance, set only for visible cells. Used for Cell Visibility Event callbacks.
  38. */
  39. @property (nonatomic, weak) UIScrollView *scrollView;
  40. - (void)__setSelectedFromUIKit:(BOOL)selected;
  41. - (void)__setHighlightedFromUIKit:(BOOL)highlighted;
  42. /**
  43. * @note This could be declared @c copy, but since this is only settable internally, we can ensure
  44. * that it's always safe simply to retain it, and copy if needed. Since @c UICollectionViewLayoutAttributes
  45. * is always mutable, @c copy is never "free" like it is for e.g. NSString.
  46. */
  47. @property (nonatomic, strong, nullable) UICollectionViewLayoutAttributes *layoutAttributes;
  48. /// readwrite variant of the readonly public property.
  49. @property (nonatomic, copy, nullable) NSString *supplementaryElementKind;
  50. @property (nonatomic, copy, nullable) NSIndexPath *cachedIndexPath;
  51. @property (weak, nonatomic, nullable) ASDisplayNode *owningNode;
  52. @end
  53. NS_ASSUME_NONNULL_END