mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-23 14:05:33 +00:00
Support background colour and selection style on ASCellNodes.
Most UITableViewCell properties aren't useful in conjunction with ASCellNode -- the system's UIView properties are unsupported for performance reasons, and properties that configure them (e.g., content indentation) don't affect custom node hierarchies. This patch adds support to _ASTableViewCell for the properties that *are* useful. r=scottg
This commit is contained in:
parent
687b79eede
commit
a3e78d1cee
@ -13,7 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
@interface ASCellNode : ASDisplayNode
|
@interface ASCellNode : ASDisplayNode
|
||||||
|
|
||||||
// TODO expose some UITableViewCell properties for configuration, eg, separator style
|
/*
|
||||||
|
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
|
||||||
|
*/
|
||||||
|
//@property (atomic, retain) UIColor *backgroundColor;
|
||||||
|
@property (nonatomic) UITableViewCellSelectionStyle selectionStyle;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
// use UITableViewCell defaults
|
||||||
|
_selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ static BOOL _isInterceptedSelector(SEL sel)
|
|||||||
cell = [[_ASTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
|
cell = [[_ASTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
[_rangeController configureContentView:cell.contentView forIndexPath:indexPath];
|
[_rangeController configureTableViewCell:cell forIndexPath:indexPath];
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,15 @@ typedef struct {
|
|||||||
- (NSInteger)numberOfSizedSections;
|
- (NSInteger)numberOfSizedSections;
|
||||||
- (NSInteger)numberOfSizedRowsInSection:(NSInteger)section;
|
- (NSInteger)numberOfSizedRowsInSection:(NSInteger)section;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the specified UITableViewCell's content view, and apply properties from ASCellNode.
|
||||||
|
*
|
||||||
|
* @param cell UITableViewCell to configure.
|
||||||
|
*
|
||||||
|
* @param indexPath Index path for the node of interest.
|
||||||
|
*/
|
||||||
|
- (void)configureTableViewCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the sized node for `indexPath` as a subview of `contentView`.
|
* Add the sized node for `indexPath` as a subview of `contentView`.
|
||||||
*
|
*
|
||||||
|
@ -351,6 +351,15 @@ static BOOL ASRangeIsValid(NSRange range)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)configureTableViewCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
[self configureContentView:cell.contentView forIndexPath:indexPath];
|
||||||
|
|
||||||
|
ASCellNode *node = [self sizedNodeForIndexPath:indexPath];
|
||||||
|
cell.backgroundColor = node.backgroundColor;
|
||||||
|
cell.selectionStyle = node.selectionStyle;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)configureContentView:(UIView *)contentView forIndexPath:(NSIndexPath *)indexPath
|
- (void)configureContentView:(UIView *)contentView forIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
ASCellNode *newNode = [self sizedNodeForIndexPath:indexPath];
|
ASCellNode *newNode = [self sizedNodeForIndexPath:indexPath];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user