[ASTextNode] Actually deprecate attributedString property (#2151)

This commit is contained in:
Adlai Holler
2016-09-01 16:43:03 -07:00
committed by GitHub
parent f8e135a1be
commit 5e3627a9cd
31 changed files with 65 additions and 65 deletions

View File

@@ -34,7 +34,7 @@ static CGFloat kInsets = 15.0;
self = [super init];
if (self != nil) {
_textNode = [[ASTextNode alloc] init];
_textNode.attributedString = [[NSAttributedString alloc] initWithString:text
_textNode.attributedText = [[NSAttributedString alloc] initWithString:text
attributes:[self textAttributes]];
[self addSubnode:_textNode];
}

View File

@@ -70,7 +70,7 @@
_photoImageView.layerBacked = YES;
_userNameLabel = [[ASTextNode alloc] init];
_userNameLabel.attributedString = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE];
_userNameLabel.attributedText = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE];
_photoLocationLabel = [[ASTextNode alloc] init];
_photoLocationLabel.maximumNumberOfLines = 1;
@@ -80,7 +80,7 @@
// make sure to use _photoModel instance variable as photo may change when cell is reused,
// where as local variable will never change
if (locationModel == _photoModel.location) {
_photoLocationLabel.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE];
_photoLocationLabel.attributedText = [photo locationAttributedStringWithFontSize:FONT_SIZE];
[self setNeedsLayout];
}
}];
@@ -181,7 +181,7 @@
{
ASTextNode *textNode = [[ASTextNode alloc] init];
textNode.layerBacked = YES;
textNode.attributedString = attributedString;
textNode.attributedText = attributedString;
return textNode;
}

View File

@@ -79,7 +79,7 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
BOOL hasDescription = self.descriptionNode.attributedString.length > 0;
BOOL hasDescription = self.descriptionNode.attributedText.length > 0;
ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec verticalStackLayoutSpec];
verticalStackLayoutSpec.spacing = 5.0;
@@ -184,7 +184,7 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr
#pragma mark ASTextNode
ASTextNode *textNode = [ASTextNode new];
textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."];
textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."];
parentNode = [self centeringParentNodeWithChild:textNode];
parentNode.entryTitle = @"ASTextNode";
@@ -529,11 +529,11 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr
NSFontAttributeName : [UIFont boldSystemFontOfSize:14.0],
NSForegroundColorAttributeName : [UIColor blackColor]
};
cellNode.titleNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes];
cellNode.titleNode.attributedText = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes];
if (node.entryDescription) {
NSDictionary *descriptionNodeAttributes = @{NSForegroundColorAttributeName : [UIColor lightGrayColor]};
cellNode.descriptionNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes];
cellNode.descriptionNode.attributedText = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes];
}
return cellNode;

View File

@@ -72,7 +72,7 @@ static CGFloat kTextPadding = 10.0f;
NSForegroundColorAttributeName: [UIColor blueColor],
NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot),
} range:[blurb rangeOfString:@"catipsum.com"]];
_textNode.attributedString = string;
_textNode.attributedText = string;
// add it as a subnode, and we're done
[self addSubnode:_textNode];

View File

@@ -152,33 +152,33 @@ const CGFloat kSoldOutGBHeight = 50.0;
- (void)updateLabels {
// Set Title text
if (self.viewModel.titleText) {
self.titleLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.titleText attributes:[ItemStyles titleStyle]];
self.titleLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.titleText attributes:[ItemStyles titleStyle]];
}
if (self.viewModel.firstInfoText) {
self.firstInfoLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.firstInfoText attributes:[ItemStyles subtitleStyle]];
self.firstInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.firstInfoText attributes:[ItemStyles subtitleStyle]];
}
if (self.viewModel.secondInfoText) {
self.secondInfoLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.secondInfoText attributes:[ItemStyles secondInfoStyle]];
self.secondInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.secondInfoText attributes:[ItemStyles secondInfoStyle]];
}
if (self.viewModel.originalPriceText) {
self.originalPriceLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.originalPriceText attributes:[ItemStyles originalPriceStyle]];
self.originalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.originalPriceText attributes:[ItemStyles originalPriceStyle]];
}
if (self.viewModel.finalPriceText) {
self.finalPriceLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.finalPriceText attributes:[ItemStyles finalPriceStyle]];
self.finalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.finalPriceText attributes:[ItemStyles finalPriceStyle]];
}
if (self.viewModel.distanceLabelText) {
NSString *format = [ItemNode isRTL] ? @"%@ •" : @"• %@";
NSString *distanceText = [NSString stringWithFormat:format, self.viewModel.distanceLabelText];
self.distanceLabel.attributedString = [[NSAttributedString alloc] initWithString:distanceText attributes:[ItemStyles distanceStyle]];
self.distanceLabel.attributedText = [[NSAttributedString alloc] initWithString:distanceText attributes:[ItemStyles distanceStyle]];
}
BOOL isSoldOut = self.viewModel.soldOutText != nil;
if (isSoldOut) {
NSString *soldOutText = self.viewModel.soldOutText;
self.soldOutLabelFlat.attributedString = [[NSAttributedString alloc] initWithString:soldOutText attributes:[ItemStyles soldOutStyle]];
self.soldOutLabelFlat.attributedText = [[NSAttributedString alloc] initWithString:soldOutText attributes:[ItemStyles soldOutStyle]];
}
self.soldOutOverlay.hidden = !isSoldOut;
self.soldOutLabelFlat.hidden = !isSoldOut;
@@ -186,7 +186,7 @@ const CGFloat kSoldOutGBHeight = 50.0;
BOOL hasBadge = self.viewModel.badgeText != nil;
if (hasBadge) {
self.badge.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.badgeText attributes:[ItemStyles badgeStyle]];
self.badge.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.badgeText attributes:[ItemStyles badgeStyle]];
self.badge.backgroundColor = [ItemStyles badgeColor];
}
self.badge.hidden = !hasBadge;

View File

@@ -63,7 +63,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName";
NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot),
}
range:[blurb rangeOfString:@"placekitten.com"]];
_textNode.attributedString = string;
_textNode.attributedText = string;
// add it as a subnode, and we're done
[self addSubnode:_textNode];

View File

@@ -98,7 +98,7 @@ static const CGFloat kInnerPadding = 10.0f;
// lorem ipsum text, plus some nice styling
_textNode = [[ASTextNode alloc] init];
_textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum]
_textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum]
attributes:[self textStyle]];
[self addSubnode:_textNode];

View File

@@ -38,7 +38,7 @@
_countNode = [[ASTextNode alloc] init];
if (_commentsCount > 0) {
_countNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]];
_countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]];
}
[self addSubnode:_countNode];

View File

@@ -42,7 +42,7 @@
if (_likesCount > 0) {
NSDictionary *attributes = _liked ? [TextStyles cellControlColoredStyle] : [TextStyles cellControlStyle];
_countNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes];
_countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes];
}
[self addSubnode:_countNode];

View File

@@ -52,13 +52,13 @@
// Name node
_nameNode = [[ASTextNode alloc] init];
_nameNode.attributedString = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]];
_nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]];
_nameNode.maximumNumberOfLines = 1;
[self addSubnode:_nameNode];
// Username node
_usernameNode = [[ASTextNode alloc] init];
_usernameNode.attributedString = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]];
_usernameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]];
_usernameNode.flexShrink = YES; //if name and username don't fit to cell width, allow username shrink
_usernameNode.truncationMode = NSLineBreakByTruncatingTail;
_usernameNode.maximumNumberOfLines = 1;
@@ -66,7 +66,7 @@
// Time node
_timeNode = [[ASTextNode alloc] init];
_timeNode.attributedString = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]];
_timeNode.attributedText = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]];
[self addSubnode:_timeNode];
// Post node
@@ -98,7 +98,7 @@
_postNode.delegate = self;
_postNode.userInteractionEnabled = YES;
_postNode.linkAttributeNames = @[ kLinkAttributeName ];
_postNode.attributedString = attrString;
_postNode.attributedText = attrString;
_postNode.passthroughNonlinkTouches = YES; // passes touches through when they aren't on a link
}

View File

@@ -27,7 +27,7 @@ final class TailLoadingCellNode: ASCellNode {
override init() {
super.init()
addSubnode(text)
text.attributedString = NSAttributedString(
text.attributedText = NSAttributedString(
string: "Loading…",
attributes: [
NSFontAttributeName: UIFont.systemFontOfSize(12),

View File

@@ -68,7 +68,7 @@
- (void)setIndexPath:(NSIndexPath *)indexPath
{
_indexPath = indexPath;
_indexPathTextNode.attributedString = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil];
_indexPathTextNode.attributedText = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil];
}
//- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize