Fix example projects to use Layout API 2.0 style object (#2285)

* fix examples/ASDKLayoutTransition

* fix examples/ASMapNode to use new Layout API 2.0

* fix examples/SocialAppLayout to use Layout API 2.0

* fix CatDealsCollectionView to use Layout API 2.0

* fix examples/AsyncDisplayKitOverview to use Layout API 2.0

* Kittens Layout API 2.0 fixes

* HorizontalWithinVerticalScrolling

* VerticalWithinHorizontalScrolling

* ASDKTube

* fix ASViewController

* fix layout

* fix layout

* fix size
This commit is contained in:
Hannah Troisi
2016-09-23 16:24:21 -07:00
committed by GitHub
parent ce1d21dc63
commit b18e1bc071
18 changed files with 105 additions and 105 deletions

View File

@@ -75,8 +75,8 @@ const CGFloat kSoldOutGBHeight = 50.0;
self.titleLabel = [[ASTextNode alloc] init];
self.titleLabel.maximumNumberOfLines = 2;
self.titleLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.titleLabel.flexGrow = YES;
self.titleLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
self.titleLabel.style.flexGrow = YES;
self.titleLabel.layerBacked = YES;
self.firstInfoLabel = [[ASTextNode alloc] init];
@@ -107,14 +107,14 @@ const CGFloat kSoldOutGBHeight = 50.0;
self.soldOutLabelFlat.layerBacked = YES;
self.soldOutLabelBackground = [[ASDisplayNode alloc] init];
self.soldOutLabelBackground.width = ASDimensionMakeWithFraction(1.0);
self.soldOutLabelBackground.height = ASDimensionMakeWithPoints(kSoldOutGBHeight);
self.soldOutLabelBackground.style.width = ASDimensionMakeWithFraction(1.0);
self.soldOutLabelBackground.style.height = ASDimensionMakeWithPoints(kSoldOutGBHeight);
self.soldOutLabelBackground.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9];
self.soldOutLabelBackground.flexGrow = YES;
self.soldOutLabelBackground.style.flexGrow = YES;
self.soldOutLabelBackground.layerBacked = YES;
self.soldOutOverlay = [[ASDisplayNode alloc] init];
self.soldOutOverlay.flexGrow = YES;
self.soldOutOverlay.style.flexGrow = YES;
self.soldOutOverlay.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
self.soldOutOverlay.layerBacked = YES;
@@ -135,18 +135,18 @@ const CGFloat kSoldOutGBHeight = 50.0;
self.soldOutLabelFlat.hidden = YES;
if ([ItemNode isRTL]) {
self.titleLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.firstInfoLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.distanceLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.secondInfoLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.originalPriceLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.finalPriceLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.titleLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
self.firstInfoLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
self.distanceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
self.secondInfoLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
self.originalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
self.finalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
} else {
self.firstInfoLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.distanceLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.secondInfoLabel.alignSelf = ASStackLayoutAlignSelfStart;
self.originalPriceLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.finalPriceLabel.alignSelf = ASStackLayoutAlignSelfEnd;
self.firstInfoLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
self.distanceLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
self.secondInfoLabel.style.alignSelf = ASStackLayoutAlignSelfStart;
self.originalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
self.finalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd;
}
}
@@ -257,13 +257,13 @@ const CGFloat kSoldOutGBHeight = 50.0;
UIEdgeInsets textInsets = UIEdgeInsetsMake(kInsetTop, kInsetHorizontal, kInsetBottom, kInsetHorizontal);
ASLayoutSpec *verticalSpacer = [[ASLayoutSpec alloc] init];
verticalSpacer.flexGrow = YES;
verticalSpacer.style.flexGrow = YES;
ASLayoutSpec *horizontalSpacer1 = [[ASLayoutSpec alloc] init];
horizontalSpacer1.flexGrow = YES;
horizontalSpacer1.style.flexGrow = YES;
ASLayoutSpec *horizontalSpacer2 = [[ASLayoutSpec alloc] init];
horizontalSpacer2.flexGrow = YES;
horizontalSpacer2.style.flexGrow = YES;
NSArray *info1Children = @[self.firstInfoLabel, self.distanceLabel, horizontalSpacer1, self.originalPriceLabel];
NSArray *info2Children = @[self.secondInfoLabel, horizontalSpacer2, self.finalPriceLabel];
@@ -279,7 +279,7 @@ const CGFloat kSoldOutGBHeight = 50.0;
ASStackLayoutSpec *textStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0.0 justifyContent:ASStackLayoutJustifyContentEnd alignItems:ASStackLayoutAlignItemsStretch children:@[self.titleLabel, verticalSpacer, info1Stack, info2Stack]];
ASInsetLayoutSpec *textWrapper = [ASInsetLayoutSpec insetLayoutSpecWithInsets:textInsets child:textStack];
textWrapper.flexGrow = YES;
textWrapper.style.flexGrow = YES;
return textWrapper;
}
@@ -289,12 +289,12 @@ const CGFloat kSoldOutGBHeight = 50.0;
ASRatioLayoutSpec *imagePlace = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:imageRatio child:self.dealImageView];
self.badge.layoutPosition = CGPointMake(0, constrainedSize.max.height - kFixedLabelsAreaHeight - kBadgeHeight);
self.badge.height = ASDimensionMakeWithPoints(kBadgeHeight);
self.badge.style.layoutPosition = CGPointMake(0, constrainedSize.max.height - kFixedLabelsAreaHeight - kBadgeHeight);
self.badge.style.height = ASDimensionMakeWithPoints(kBadgeHeight);
ASStaticLayoutSpec *badgePosition = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.badge]];
ASOverlayLayoutSpec *badgeOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imagePlace overlay:badgePosition];
badgeOverImage.flexGrow = YES;
badgeOverImage.style.flexGrow = YES;
return badgeOverImage;
}

View File

@@ -53,7 +53,7 @@ static CGFloat kFixedHeight = 200.0f;
[spinner startAnimating];
return spinner;
}];
[_loadingSpinner setSizeWithCGSize:CGSizeMake(50, 50)];
[_loadingSpinner.style setSizeWithCGSize:CGSizeMake(50, 50)];
// add it as a subnode, and we're done
[self addSubnode:_loadingSpinner];
@@ -75,4 +75,4 @@ static CGFloat kFixedHeight = 200.0f;
return centerSpec;
}
@end
@end