diff --git a/_docs/asviewcontroller.md b/_docs/asviewcontroller.md index 5cada643..d1226bd4 100755 --- a/_docs/asviewcontroller.md +++ b/_docs/asviewcontroller.md @@ -11,7 +11,10 @@ The main difference is that you construct and return the node you'd like managed Consider the following ASViewController subclass that would like to use a custom table node as its managed node. -``` +
- (instancetype)initWithModel:(NSArray *)models
{
ASTableNode *tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
@@ -25,7 +28,24 @@ Consider the following ASViewController subclass that would like to use a custom
return self;
}
-```
+
+
+
+
ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.backgroundColor = [UIColor orangeColor];
node.bounds = CGRectMake(0, 0, 100, 100);
NSLog(@"Underlying view: %@", node.view);
-```
+
+
+
+
ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.clipsToBounds = YES; // not .masksToBounds
node.borderColor = [UIColor blueColor]; //layer name when there is no UIView equivalent
-NSLog(@"%@", node.layer);
-```
+
+NSLog(@"Backing layer: %@", node.layer);
+
+
+
+CALayer just as you would when dealing with a plain UIView.
@@ -36,12 +65,25 @@ When used with one of the
+SwiftObjective-C
+
+
ASDisplayNode *node = [ASDisplayNode alloc] initWithViewBlock:^{
SomeView *view = [[SomeView alloc] init];
return view;
}];
-```
+
+
+
+
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec];
- verticalStack.direction = ASStackLayoutDirectionVertical;
+ verticalStack.direction = ASStackLayoutDirectionVertical;
verticalStack.spacing = 4.0;
[verticalStack setChildren:_commentNodes];
-
+
return verticalStack;
}
-```
+
+
+
+
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec];
- verticalStack.direction = ASStackLayoutDirectionVertical;
+ verticalStack.direction = ASStackLayoutDirectionVertical;
verticalStack.spacing = 4.0;
[verticalStack setChildren:_commentNodes];
UIEdgeInsets insets = UIEdgeInsetsMake(8, 8, 8, 8);
ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets
- child:verticalStack];
+ child:verticalStack];
return insetSpec;
}
-```
+
+
+
+