[ASCellNode] Support for wrapping UIViewControllers#931
[ASCellNode] Support for wrapping UIViewControllers#931appleguy merged 6 commits intofacebookarchive:masterfrom
Conversation
|
Also the sample app is called |
|
@appleguy thanks/no problem! Side note: I noticed that viewWillAppear and viewDidAppear seemed to already work on the view controllers I threw in there. Also, I think this way of resizing the view controller's views makes sense since it's similar to the way Apple talks about container view controllers resizing the views of the view controllers they contain. |
|
Oh also, View Controllers do have a preferredContentSize that's intended to be used for popovers. If we want to go the other direction and have the view controllers inform the cell size I assume we could use that? |
There was a problem hiding this comment.
Just to reduce API surface area, I think we should probably kill this variant. Passing nil as the didLoadBlock is pretty reasonable especially since this will not be a very common call in people's apps.
|
@lappp9 ok, I will land this tomorrow if you are able to do another round on feedback! I'd like to build off this patch this weekend with some customizations for ASViewController-based wrapping (setting interfaceState automatically etc), as I am currently adopting ASPagerNode in Pinterest and want it to page through ASVCs (but it currently expects ASCellNodes, so this is directionally what is necessary). Thanks for your work across the project, it is really cool! |
|
Nice improvements! I'll go ahead and land this now, but it is /very/ important that we ensure the view controller as well as its view are not created until the -didLoad call. I'll probably end up modifying this behavior for ASViewControllers though, so if you had to choose, feel free to focus on the video node first. |
[ASCellNode] Support for wrapping UIViewControllers
This is a bit of a work in progress, but I'm taking a crack and initializing an ASCellNode with a UIViewControllerBlock. This example image shows the collection view example except the views shown in the cells are generated from an ImageViewController that has an imageView as a subview.
Right now it grabs the vc's view, makes a subnode out of it and adds it as a subnode of the cell. I'm resizing the vc's view based on what comes through in layoutSpecThatFits but that might be a little off or not the right way to do it.
Random thought, would it be smart to take the vc's view, calculate the aspect ratio of the size that was calculated for the cell by layoutSpecThatFits and then apply a transform to that view to make it fit in that aspect ratio?
Also touch handling is lost right now but I assume you could forward the taps to the saved vc if there is one?