Add backgroundView for ASCellNode #trivial (#1333)

This commit is contained in:
Leonid Lyadveykin 2019-02-15 23:52:48 +03:00 committed by Huy Nguyen
parent 2a1e03fe75
commit 8908030eeb
3 changed files with 8 additions and 0 deletions

View File

@ -194,6 +194,12 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
*/
@property (nullable) UIView *selectedBackgroundView;
/* @abstract The view used as the background of the cell.
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
* ASCollectionView uses these properties when configuring UICollectionViewCells that host ASCellNodes.
*/
@property (nullable) UIView *backgroundView;
/* @abstract The accessory type view on the right side of the cell. Please take care of your ASLayoutSpec so that doesn't overlay the accessoryView
* @default UITableViewCellAccessoryNone
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.

View File

@ -1229,6 +1229,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
// Update the selected background view in collectionView:willDisplayCell:forItemAtIndexPath: otherwise it could be too
// early e.g. if the selectedBackgroundView was set in didLoad()
cell.selectedBackgroundView = cellNode.selectedBackgroundView;
cell.backgroundView = cellNode.backgroundView;
// Under iOS 10+, cells may be removed/re-added to the collection view without
// receiving prepareForReuse/applyLayoutAttributes, as an optimization for e.g.

View File

@ -109,6 +109,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
if (node) {
self.backgroundColor = node.backgroundColor;
self.selectedBackgroundView = node.selectedBackgroundView;
self.backgroundView = node.backgroundView;
#if TARGET_OS_IOS
self.separatorInset = node.separatorInset;
#endif