mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-24 03:45:58 +08:00
Don't use automaticallyManageSubnodes in ASTextCellNode (#2212)
This commit is contained in:
committed by
Adlai Holler
parent
5593bfa4d1
commit
53a6743908
@@ -338,8 +338,8 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f;
|
||||
if (self) {
|
||||
_textInsets = textInsets;
|
||||
_textAttributes = [textAttributes copy];
|
||||
self.automaticallyManagesSubnodes = YES;
|
||||
_textNode = [[ASTextNode alloc] init];
|
||||
[self addSubnode:_textNode];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.automaticallyManagesSubnodes = YES;
|
||||
|
||||
_commentNodes = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
@@ -53,7 +55,7 @@
|
||||
- (void)updateWithCommentFeedModel:(CommentFeedModel *)feed
|
||||
{
|
||||
_commentFeed = feed;
|
||||
[self removeCommentLabels];
|
||||
[_commentNodes removeAllObjects];
|
||||
|
||||
if (_commentFeed) {
|
||||
[self createCommentLabels];
|
||||
@@ -64,7 +66,7 @@
|
||||
|
||||
if (addViewAllCommentsLabel) {
|
||||
commentLabelString = [_commentFeed viewAllCommentsAttributedString];
|
||||
[[_commentNodes objectAtIndex:labelsIndex] setAttributedString:commentLabelString];
|
||||
[_commentNodes[labelsIndex] setAttributedText:commentLabelString];
|
||||
labelsIndex++;
|
||||
}
|
||||
|
||||
@@ -72,7 +74,7 @@
|
||||
|
||||
for (int feedIndex = 0; feedIndex < numCommentsInFeed; feedIndex++) {
|
||||
commentLabelString = [[_commentFeed objectAtIndex:feedIndex] commentAttributedString];
|
||||
[[_commentNodes objectAtIndex:labelsIndex] setAttributedString:commentLabelString];
|
||||
[_commentNodes[labelsIndex] setAttributedText:commentLabelString];
|
||||
labelsIndex++;
|
||||
}
|
||||
|
||||
@@ -83,15 +85,6 @@
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (void)removeCommentLabels
|
||||
{
|
||||
for (ASTextNode *commentLabel in _commentNodes) {
|
||||
[commentLabel removeFromSupernode];
|
||||
}
|
||||
|
||||
[_commentNodes removeAllObjects];
|
||||
}
|
||||
|
||||
- (void)createCommentLabels
|
||||
{
|
||||
BOOL addViewAllCommentsLabel = [_commentFeed numberOfCommentsForPhotoExceedsInteger:NUM_COMMENTS_TO_SHOW];
|
||||
@@ -105,7 +98,6 @@
|
||||
commentLabel.maximumNumberOfLines = 3;
|
||||
|
||||
[_commentNodes addObject:commentLabel];
|
||||
[self addSubnode:commentLabel];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
ASStackLayoutSpec *headerSubStack = [ASStackLayoutSpec verticalStackLayoutSpec];
|
||||
headerSubStack.flexShrink = YES;
|
||||
if (_photoLocationLabel.attributedString) {
|
||||
if (_photoLocationLabel.attributedText) {
|
||||
[headerSubStack setChildren:@[_userNameLabel, _photoLocationLabel]];
|
||||
} else {
|
||||
[headerSubStack setChildren:@[_userNameLabel]];
|
||||
|
||||
Reference in New Issue
Block a user