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
This commit is contained in:
Saif Al-Dilaimi 2017-01-10 03:26:51 +01:00 committed by Adlai Holler
parent c383b52e78
commit c85aa11dbb
4 changed files with 40 additions and 25 deletions

View File

@ -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)

View File

@ -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];
}

View File

@ -92,18 +92,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, readwrite) UIEdgeInsets textContainerInset;
/**
@abstract <UITextInputTraits> 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 <UITextInputTraits> 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)

View File

@ -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;