Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit ecd7727

Browse files
committed
Update Videos example to leverage automatic measure: call before layout
1 parent b4d4908 commit ecd7727

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

examples/Videos/Sample/ViewController.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ - (void)viewWillAppear:(BOOL)animated
2828

2929
// Root node for the view controller
3030
_rootNode = [ASDisplayNode new];
31+
_rootNode.frame = self.view.bounds;
3132
_rootNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
3233

3334
ASVideoNode *guitarVideoNode = self.guitarVideoNode;
@@ -54,16 +55,6 @@ - (void)viewWillAppear:(BOOL)animated
5455
[self.view addSubnode:_rootNode];
5556
}
5657

57-
- (void)viewDidLayoutSubviews
58-
{
59-
[super viewDidLayoutSubviews];
60-
61-
// After all subviews are layed out we have to measure it and move the root node to the right place
62-
CGSize viewSize = self.view.bounds.size;
63-
[self.rootNode measureWithSizeRange:ASSizeRangeMake(viewSize, viewSize)];
64-
[self.rootNode setNeedsLayout];
65-
}
66-
6758
#pragma mark - Getter / Setter
6859

6960
- (ASVideoNode *)guitarVideoNode;

0 commit comments

Comments
 (0)