mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
[ASTextNode] Actually deprecate attributedString property (#2151)
This commit is contained in:
@@ -183,8 +183,8 @@
|
||||
newTitle = _normalAttributedTitle;
|
||||
}
|
||||
|
||||
if ((_titleNode != nil || newTitle.length > 0) && [self.titleNode.attributedString isEqualToAttributedString:newTitle] == NO) {
|
||||
_titleNode.attributedString = newTitle;
|
||||
if ((_titleNode != nil || newTitle.length > 0) && [self.titleNode.attributedText isEqualToAttributedString:newTitle] == NO) {
|
||||
_titleNode.attributedText = newTitle;
|
||||
self.accessibilityLabel = _titleNode.accessibilityLabel;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
@@ -479,7 +479,7 @@
|
||||
[children addObject:_imageNode];
|
||||
}
|
||||
|
||||
if (_titleNode.attributedString.length > 0) {
|
||||
if (_titleNode.attributedText.length > 0) {
|
||||
[children addObject:_titleNode];
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@
|
||||
[super layout];
|
||||
_backgroundImageNode.hidden = (_backgroundImageNode.image == nil);
|
||||
_imageNode.hidden = (_imageNode.image == nil);
|
||||
_titleNode.hidden = (_titleNode.attributedString.length == 0);
|
||||
_titleNode.hidden = (_titleNode.attributedText.length == 0);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -297,7 +297,7 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f;
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithAttributes:[self defaultTextAttributes] insets:[self defaultTextInsets]];
|
||||
return [self initWithAttributes:[ASTextCellNode defaultTextAttributes] insets:[ASTextCellNode defaultTextInsets]];
|
||||
}
|
||||
|
||||
- (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets
|
||||
@@ -306,8 +306,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;
|
||||
}
|
||||
@@ -317,12 +317,12 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f;
|
||||
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:self.textInsets child:self.textNode];
|
||||
}
|
||||
|
||||
- (NSDictionary *)defaultTextAttributes
|
||||
+ (NSDictionary *)defaultTextAttributes
|
||||
{
|
||||
return @{NSFontAttributeName : [UIFont systemFontOfSize:kASTextCellNodeDefaultFontSize]};
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)defaultTextInsets
|
||||
+ (UIEdgeInsets)defaultTextInsets
|
||||
{
|
||||
return UIEdgeInsetsMake(kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding, kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding);
|
||||
}
|
||||
@@ -333,14 +333,14 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f;
|
||||
|
||||
_textAttributes = [textAttributes copy];
|
||||
|
||||
[self updateAttributedString];
|
||||
[self updateAttributedText];
|
||||
}
|
||||
|
||||
- (void)setTextInsets:(UIEdgeInsets)textInsets
|
||||
{
|
||||
_textInsets = textInsets;
|
||||
|
||||
[self updateAttributedString];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)setText:(NSString *)text
|
||||
@@ -349,17 +349,17 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f;
|
||||
|
||||
_text = [text copy];
|
||||
|
||||
[self updateAttributedString];
|
||||
[self updateAttributedText];
|
||||
}
|
||||
|
||||
- (void)updateAttributedString
|
||||
- (void)updateAttributedText
|
||||
{
|
||||
if (_text == nil) {
|
||||
_textNode.attributedString = nil;
|
||||
_textNode.attributedText = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
_textNode.attributedString = [[NSAttributedString alloc] initWithString:self.text attributes:self.textAttributes];
|
||||
_textNode.attributedText = [[NSAttributedString alloc] initWithString:self.text attributes:self.textAttributes];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
|
||||
@@ -326,12 +326,12 @@ struct ASImageNodeDrawParameters {
|
||||
CGFloat pixelCountRatio = (imageSizeInPixels.width * imageSizeInPixels.height) / (boundsSizeInPixels.width * boundsSizeInPixels.height);
|
||||
if (pixelCountRatio != 1.0) {
|
||||
NSString *scaleString = [NSString stringWithFormat:@"%.2fx", pixelCountRatio];
|
||||
_debugLabelNode.attributedString = [[NSAttributedString alloc] initWithString:scaleString attributes:[self debugLabelAttributes]];
|
||||
_debugLabelNode.attributedText = [[NSAttributedString alloc] initWithString:scaleString attributes:[self debugLabelAttributes]];
|
||||
_debugLabelNode.hidden = NO;
|
||||
[self setNeedsLayout];
|
||||
} else {
|
||||
_debugLabelNode.hidden = YES;
|
||||
_debugLabelNode.attributedString = nil;
|
||||
_debugLabelNode.attributedText = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -291,16 +291,16 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
|
||||
|
||||
@see attributedText
|
||||
*/
|
||||
@property (nullable, nonatomic, copy) NSAttributedString *attributedString;
|
||||
@property (nullable, nonatomic, copy) NSAttributedString *attributedString ASDISPLAYNODE_DEPRECATED;
|
||||
|
||||
|
||||
/**
|
||||
The truncationAttributedString and truncationAttributedText properties are equivalent, but attributedText is now the
|
||||
The truncationAttributedString and truncationAttributedText properties are equivalent, but truncationAttributedText is now the
|
||||
standard API name in order to match UILabel and ASEditableTextNode.
|
||||
|
||||
@see truncationAttributedText
|
||||
*/
|
||||
@property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedString;
|
||||
@property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedString ASDISPLAYNODE_DEPRECATED;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
{
|
||||
if (_elapsedTextNode == nil) {
|
||||
_elapsedTextNode = [[ASTextNode alloc] init];
|
||||
_elapsedTextNode.attributedString = [self timeLabelAttributedStringForString:@"00:00"
|
||||
_elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00"
|
||||
forControlType:ASVideoPlayerNodeControlTypeElapsedText];
|
||||
_elapsedTextNode.truncationMode = NSLineBreakByClipping;
|
||||
|
||||
@@ -359,7 +359,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
{
|
||||
if (_durationTextNode == nil) {
|
||||
_durationTextNode = [[ASTextNode alloc] init];
|
||||
_durationTextNode.attributedString = [self timeLabelAttributedStringForString:@"00:00"
|
||||
_durationTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00"
|
||||
forControlType:ASVideoPlayerNodeControlTypeDurationText];
|
||||
_durationTextNode.truncationMode = NSLineBreakByClipping;
|
||||
|
||||
@@ -428,7 +428,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
return;
|
||||
}
|
||||
NSString *formattedDuration = [self timeStringForCMTime:_duration forTimeLabelType:ASVideoPlayerNodeControlTypeDurationText];
|
||||
_durationTextNode.attributedString = [self timeLabelAttributedStringForString:formattedDuration forControlType:ASVideoPlayerNodeControlTypeDurationText];
|
||||
_durationTextNode.attributedText = [self timeLabelAttributedStringForString:formattedDuration forControlType:ASVideoPlayerNodeControlTypeDurationText];
|
||||
}
|
||||
|
||||
- (void)updateElapsedTimeLabel:(NSTimeInterval)seconds
|
||||
@@ -436,8 +436,8 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
if (!_elapsedTextNode) {
|
||||
return;
|
||||
}
|
||||
NSString *formatteElapsed = [self timeStringForCMTime:CMTimeMakeWithSeconds( seconds, _videoNode.periodicTimeObserverTimescale ) forTimeLabelType:ASVideoPlayerNodeControlTypeElapsedText];
|
||||
_elapsedTextNode.attributedString = [self timeLabelAttributedStringForString:formatteElapsed forControlType:ASVideoPlayerNodeControlTypeElapsedText];
|
||||
NSString *formattedElapsed = [self timeStringForCMTime:CMTimeMakeWithSeconds( seconds, _videoNode.periodicTimeObserverTimescale ) forTimeLabelType:ASVideoPlayerNodeControlTypeElapsedText];
|
||||
_elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:formattedElapsed forControlType:ASVideoPlayerNodeControlTypeElapsedText];
|
||||
}
|
||||
|
||||
- (NSAttributedString*)timeLabelAttributedStringForString:(NSString*)string forControlType:(ASVideoPlayerNodeControlType)controlType
|
||||
|
||||
@@ -704,7 +704,7 @@ static BOOL __shouldShowRangeDebugOverlay = NO;
|
||||
_debugString = [[_rangeController dataSource] nameForRangeControllerDataSource];
|
||||
}
|
||||
if (_debugString) {
|
||||
_debugText.attributedString = [_ASRangeDebugBarView whiteAttributedStringFromString:_debugString withSize:size];
|
||||
_debugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:_debugString withSize:size];
|
||||
}
|
||||
|
||||
if (ASScrollDirectionContainsVerticalDirection(_scrollDirection)) {
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -89,7 +89,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]];
|
||||
_textNode.flexShrink = YES;
|
||||
_textNode.flexGrow = YES;
|
||||
|
||||
@@ -66,7 +66,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName";
|
||||
}
|
||||
range:[blurb rangeOfString:@"placekitten.com"]];
|
||||
|
||||
_textNode.attributedString = string;
|
||||
_textNode.attributedText = string;
|
||||
|
||||
ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec verticalStackLayoutSpec];
|
||||
stackSpec.children = @[_textNode, _buttonNode];
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
ASTextNode *node = [[ASTextNode alloc] init];
|
||||
node.attributedString = [[NSAttributedString alloc] initWithString:@"hello world"];
|
||||
node.attributedText = [[NSAttributedString alloc] initWithString:@"hello world"];
|
||||
[node measure:(CGSize){.width = screenSize.width, .height = CGFLOAT_MAX}];
|
||||
node.frame = (CGRect) {.origin = (CGPoint){.x = 100, .y = 100}, .size = node.calculatedSize };
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
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];
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
_node = [[ASTextNode alloc] init];
|
||||
_node.maximumNumberOfLines = 3;
|
||||
_node.backgroundColor = [UIColor lightGrayColor];
|
||||
_node.attributedString = string;
|
||||
_node.attributedText = string;
|
||||
_node.frame = CGRectMake(70, 400, 40, 100);
|
||||
// [_node measure:CGSizeMake(40, 50)]; No longer needed now that https://github.com/facebook/AsyncDisplayKit/issues/1295 is fixed.
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
[self setText:[NSString stringWithFormat:@"loaded '%@'", imageIdentifier]];
|
||||
|
||||
if ([imageIdentifier isEqualToString:@"best"]) {
|
||||
[self setText:[_buttonNode.titleNode.attributedString.string stringByAppendingString:@". tap to reload"]];
|
||||
[self setText:[_buttonNode.titleNode.attributedText.string stringByAppendingString:@". tap to reload"]];
|
||||
_buttonNode.userInteractionEnabled = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
NSString *text = @"Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.";
|
||||
NSDictionary *attributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:17.0] };
|
||||
_textNode.attributedString = [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
||||
_textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
||||
|
||||
_needyChildNode = [[SlowpokeShareNode alloc] init];
|
||||
_needyChildNode.opaque = NO;
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
_textNode = [[ASTextNode alloc] init];
|
||||
_textNode.placeholderEnabled = NO;
|
||||
_textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Hello, ASDK!"
|
||||
_textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, ASDK!"
|
||||
attributes:[self textStyle]];
|
||||
[self addSubnode:_textNode];
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -97,7 +97,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];
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName";
|
||||
// generate an attributed string using the custom link attribute specified above
|
||||
NSString *blurb = @"Nic Cage courtesy of himself.";
|
||||
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb];
|
||||
_textNode.attributedString = string;
|
||||
_textNode.attributedText = string;
|
||||
|
||||
// add it as a subnode, and we're done
|
||||
[self addSubnode:_textNode];
|
||||
|
||||
@@ -122,7 +122,7 @@ static const CGFloat kInnerPadding = 10.0f;
|
||||
[self addSubnode:_videoNode];
|
||||
|
||||
_textNode = [[ASTextNode alloc] init];
|
||||
_textNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@", methodArray[videoInitMethod], autoPlayArray[autoPlay], [self kittyIpsum]]
|
||||
_textNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@", methodArray[videoInitMethod], autoPlayArray[autoPlay], [self kittyIpsum]]
|
||||
attributes:[self textStyle]];
|
||||
[self addSubnode:_textNode];
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
self.textNode = [[ASTextNode alloc] init];
|
||||
self.textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Testing, testing." attributes:@{ NSForegroundColorAttributeName: [UIColor redColor] }];
|
||||
self.textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Testing, testing." attributes:@{ NSForegroundColorAttributeName: [UIColor redColor] }];
|
||||
[self.textNode measure:self.view.bounds.size];
|
||||
self.textNode.frame = (CGRect){ .origin = CGPointZero, .size = self.textNode.calculatedSize };
|
||||
[self.view addSubnode:self.textNode];
|
||||
|
||||
Reference in New Issue
Block a user