Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit c85aa11

Browse files
Saif Al-DilaimiAdlai Holler
authored andcommitted
Adding section to passthrough properties (#2847)
* added accessoryType to ASCellNode * Moved the passthrough properties in an own section in ASEditableTextNode * added documentation and reverted ASEditableCellNode changes * fixed code signing * adding seperatorInset property as a passthrough property * revert changes to project file * moved setting properties to setNode: * moved clipsToBounds to setNode
1 parent c383b52 commit c85aa11

4 files changed

Lines changed: 40 additions & 25 deletions

File tree

AsyncDisplayKit/ASCellNode.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
9090
*/
9191
@property (nonatomic, strong, readonly, nullable) UICollectionViewLayoutAttributes *layoutAttributes;
9292

93-
/*
94-
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
95-
*/
96-
//@property (nonatomic, retain) UIColor *backgroundColor;
97-
@property (nonatomic) UITableViewCellSelectionStyle selectionStyle;
98-
9993
/**
10094
* A Boolean value that is synchronized with the underlying collection or tableView cell property.
10195
* Setting this value is equivalent to calling selectItem / deselectItem on the collection or table.
@@ -167,6 +161,25 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
167161
*/
168162
- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame;
169163

164+
#pragma mark - UITableViewCell specific passthrough properties
165+
166+
/* @abstract The selection style when a tap on a cell occurs
167+
* @default UITableViewCellSelectionStyleDefault
168+
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
169+
*/
170+
@property (nonatomic) UITableViewCellSelectionStyle selectionStyle;
171+
172+
/* @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
173+
* @default UITableViewCellAccessoryNone
174+
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
175+
*/
176+
@property (nonatomic) UITableViewCellAccessoryType accessoryType;
177+
178+
/* @abstract The seperator inset of the cell seperator line
179+
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
180+
*/
181+
@property (nonatomic) UIEdgeInsets seperatorInset;
182+
170183
@end
171184

172185
@interface ASCellNode (Unavailable)

AsyncDisplayKit/ASCollectionView.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ - (void)setNode:(ASCellNode *)node
7676
ASDisplayNodeAssertMainThread();
7777
node.layoutAttributes = _layoutAttributes;
7878
_node = node;
79+
self.backgroundColor = node.backgroundColor;
80+
self.clipsToBounds = node.clipsToBounds;
7981
[node __setSelectedFromUIKit:self.selected];
8082
[node __setHighlightedFromUIKit:self.highlighted];
8183
}

AsyncDisplayKit/ASEditableTextNode.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,6 @@ NS_ASSUME_NONNULL_BEGIN
9292
*/
9393
@property (nonatomic, readwrite) UIEdgeInsets textContainerInset;
9494

95-
/**
96-
@abstract <UITextInputTraits> properties.
97-
*/
98-
@property(nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences
99-
@property(nonatomic, readwrite, assign) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault
100-
@property(nonatomic, readwrite, assign) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault;
101-
@property(nonatomic, readwrite, assign) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault
102-
@property(nonatomic, readwrite, assign) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault
103-
@property(nonatomic, readwrite, assign) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum)
104-
@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)
105-
@property(nonatomic, readwrite, assign, getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO
106-
10795
/**
10896
@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.
10997
@result YES if the receiver's text view is the first-responder; NO otherwise.
@@ -125,6 +113,18 @@ NS_ASSUME_NONNULL_BEGIN
125113
*/
126114
- (CGRect)frameForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT;
127115

116+
/**
117+
@abstract <UITextInputTraits> properties.
118+
*/
119+
@property(nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences
120+
@property(nonatomic, readwrite, assign) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault
121+
@property(nonatomic, readwrite, assign) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault;
122+
@property(nonatomic, readwrite, assign) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault
123+
@property(nonatomic, readwrite, assign) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault
124+
@property(nonatomic, readwrite, assign) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum)
125+
@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)
126+
@property(nonatomic, readwrite, assign, getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO
127+
128128
@end
129129

130130
@interface ASEditableTextNode (Unavailable)

AsyncDisplayKit/ASTableView.mm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ - (void)didTransitionToState:(UITableViewCellStateMask)state
7474
- (void)setNode:(ASCellNode *)node
7575
{
7676
_node = node;
77+
78+
self.backgroundColor = node.backgroundColor;
79+
self.selectionStyle = node.selectionStyle;
80+
self.accessoryType = node.accessoryType;
81+
self.separatorInset = node.seperatorInset;
82+
self.clipsToBounds = node.clipsToBounds;
83+
7784
[node __setSelectedFromUIKit:self.selected];
7885
[node __setHighlightedFromUIKit:self.highlighted];
7986
}
@@ -804,13 +811,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
804811
[_rangeController configureContentView:cell.contentView forCellNode:node];
805812

806813
cell.node = node;
807-
cell.backgroundColor = node.backgroundColor;
808-
cell.selectionStyle = node.selectionStyle;
809-
810-
// the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default)
811-
// This is actually a workaround for a bug we are seeing in some rare cases (selected background view
812-
// overlaps other cells if size of ASCellNode has changed.)
813-
cell.clipsToBounds = node.clipsToBounds;
814814
}
815815

816816
return cell;

0 commit comments

Comments
 (0)