diff --git a/AsyncDisplayKit/ASCellNode.h b/AsyncDisplayKit/ASCellNode.h index 219b197716..289e52917f 100644 --- a/AsyncDisplayKit/ASCellNode.h +++ b/AsyncDisplayKit/ASCellNode.h @@ -90,12 +90,6 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { */ @property (nonatomic, strong, readonly, nullable) UICollectionViewLayoutAttributes *layoutAttributes; -/* - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - */ -//@property (nonatomic, retain) UIColor *backgroundColor; -@property (nonatomic) UITableViewCellSelectionStyle selectionStyle; - /** * A Boolean value that is synchronized with the underlying collection or tableView cell property. * Setting this value is equivalent to calling selectItem / deselectItem on the collection or table. @@ -167,6 +161,25 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { */ - (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame; +#pragma mark - UITableViewCell specific passthrough properties + +/* @abstract The selection style when a tap on a cell occurs + * @default UITableViewCellSelectionStyleDefault + * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. + */ +@property (nonatomic) UITableViewCellSelectionStyle selectionStyle; + +/* @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. + */ +@property (nonatomic) UITableViewCellAccessoryType accessoryType; + +/* @abstract The seperator inset of the cell seperator line + * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. + */ +@property (nonatomic) UIEdgeInsets seperatorInset; + @end @interface ASCellNode (Unavailable) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 9cafd08518..958226f3c9 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -76,6 +76,8 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; ASDisplayNodeAssertMainThread(); node.layoutAttributes = _layoutAttributes; _node = node; + self.backgroundColor = node.backgroundColor; + self.clipsToBounds = node.clipsToBounds; [node __setSelectedFromUIKit:self.selected]; [node __setHighlightedFromUIKit:self.highlighted]; } diff --git a/AsyncDisplayKit/ASEditableTextNode.h b/AsyncDisplayKit/ASEditableTextNode.h index c9f61d88f7..b74f8e3d1a 100644 --- a/AsyncDisplayKit/ASEditableTextNode.h +++ b/AsyncDisplayKit/ASEditableTextNode.h @@ -92,18 +92,6 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, readwrite) UIEdgeInsets textContainerInset; -/** - @abstract properties. - */ -@property(nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences -@property(nonatomic, readwrite, assign) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault -@property(nonatomic, readwrite, assign) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault; -@property(nonatomic, readwrite, assign) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault -@property(nonatomic, readwrite, assign) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault -@property(nonatomic, readwrite, assign) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum) -@property(nonatomic, readwrite, assign) BOOL enablesReturnKeyAutomatically; // default is NO (when YES, will automatically disable return key when text widget has zero-length contents, and will automatically enable when text widget has non-zero-length contents) -@property(nonatomic, readwrite, assign, getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO - /** @abstract Indicates whether the receiver's text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user. @result YES if the receiver's text view is the first-responder; NO otherwise. @@ -125,6 +113,18 @@ NS_ASSUME_NONNULL_BEGIN */ - (CGRect)frameForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; +/** + @abstract properties. + */ +@property(nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences +@property(nonatomic, readwrite, assign) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault +@property(nonatomic, readwrite, assign) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault; +@property(nonatomic, readwrite, assign) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault +@property(nonatomic, readwrite, assign) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault +@property(nonatomic, readwrite, assign) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum) +@property(nonatomic, readwrite, assign) BOOL enablesReturnKeyAutomatically; // default is NO (when YES, will automatically disable return key when text widget has zero-length contents, and will automatically enable when text widget has non-zero-length contents) +@property(nonatomic, readwrite, assign, getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO + @end @interface ASEditableTextNode (Unavailable) diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index 13a7c1b597..f610a7ae21 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -74,6 +74,13 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; - (void)setNode:(ASCellNode *)node { _node = node; + + self.backgroundColor = node.backgroundColor; + self.selectionStyle = node.selectionStyle; + self.accessoryType = node.accessoryType; + self.separatorInset = node.seperatorInset; + self.clipsToBounds = node.clipsToBounds; + [node __setSelectedFromUIKit:self.selected]; [node __setHighlightedFromUIKit:self.highlighted]; } @@ -804,13 +811,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; [_rangeController configureContentView:cell.contentView forCellNode:node]; cell.node = node; - cell.backgroundColor = node.backgroundColor; - cell.selectionStyle = node.selectionStyle; - - // the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default) - // This is actually a workaround for a bug we are seeing in some rare cases (selected background view - // overlaps other cells if size of ASCellNode has changed.) - cell.clipsToBounds = node.clipsToBounds; } return cell;