Files
AsyncDisplayKit/_docs/containers-asviewcontroller.md
Hannah Troisi d162141e18 # This is a combination of 44 commits.
# The first commit's message is:
# This is a combination of 30 commits.
# The first commit's message is:
Update nav_docs.yml

# This is the 2nd commit message:

Create node-containers-overview.md

# This is the 3rd commit message:

Update node-containers-overview.md

# This is the 4th commit message:

Update node-containers-overview.md

# This is the 5th commit message:

Update node-containers-overview.md

# This is the 6th commit message:

Update node-containers-overview.md

# This is the 7th commit message:

Update nav_docs.yml

# This is the 8th commit message:

Update nav_docs.yml

# This is the 9th commit message:

Update and rename node-containers-overview.md to containers-overview.md

# This is the 10th commit message:

Update and rename asviewcontroller.md to container-asviewcontroller.md

# This is the 11th commit message:

Update and rename astablenode.md to container-astablenode.md

# This is the 12th commit message:

Update and rename ascollectionnode.md to container-ascollectionnode.md

# This is the 13th commit message:

Update and rename aspagernode.md to container-aspagernode.md

# This is the 14th commit message:

Update and rename container-ascollectionnode.md to containers-ascollectionnode.md

# This is the 15th commit message:

Update and rename container-asviewcontroller.md to containers-asviewcontroller.md

# This is the 16th commit message:

Update containers-ascollectionnode.md

# This is the 17th commit message:

Update container-astablenode.md

# This is the 18th commit message:

Rename container-astablenode.md to containers-astablenode.md

# This is the 19th commit message:

Update and rename container-aspagernode.md to containers-aspagernode.md

# This is the 20th commit message:

Update containers-overview.md

# This is the 21st commit message:

Update containers-overview.md

# This is the 22nd commit message:

Update containers-overview.md

# This is the 23rd commit message:

Update containers-asviewcontroller.md

# This is the 24th commit message:

Update containers-asviewcontroller.md

# This is the 25th commit message:

Update containers-overview.md

# This is the 26th commit message:

Update containers-asviewcontroller.md

# This is the 27th commit message:

Update containers-asviewcontroller.md

# This is the 28th commit message:

Update containers-asviewcontroller.md

# This is the 29th commit message:

Update containers-overview.md

# This is the 30th commit message:

Update containers-overview.md

# This is the 2nd commit message:

Removing _site folder from repository (only needed to run locally)

# This is the 3rd commit message:

Update containers-overview.md

# This is the 4th commit message:

Update containers-overview.md

# This is the 5th commit message:

Update containers-asviewcontroller.md

# This is the 6th commit message:

Update debug-tool-pixel-scaling.md

# This is the 7th commit message:

Update debug-tool-pixel-scaling.md

# This is the 8th commit message:

Update debug-tool-pixel-scaling.md

# This is the 9th commit message:

Update debug-tool-pixel-scaling.md

# This is the 10th commit message:

Update debug-tool-pixel-scaling.md

# This is the 11th commit message:

Update debug-tool-pixel-scaling.md

# This is the 12th commit message:

Update debug-tool-pixel-scaling.md

# This is the 13th commit message:

Update debug-tool-hit-test-slop.md

# This is the 14th commit message:

Update debug-tool-hit-test-slop.md

# This is the 15th commit message:

Update nav_docs.yml

# This is the 16th commit message:

Update image-node.md

# This is the 17th commit message:

Update image-node.md

# This is the 18th commit message:

Update control-node.md

# This is the 19th commit message:

Update control-node.md

# This is the 20th commit message:

Update nav_docs.yml

# This is the 21st commit message:

Create batch-fetching-api.md

# This is the 22nd commit message:

Update batch-fetching-api.md

# This is the 23rd commit message:

Update debug-tool-hit-test-slop.md

# This is the 24th commit message:

Update debug-tool-pixel-scaling.md

# This is the 25th commit message:

Update debug-tool-hit-test-slop.md

# This is the 26th commit message:

Update debug-tool-pixel-scaling.md

# This is the 27th commit message:

Update containers-aspagernode.md

# This is the 28th commit message:

Update containers-aspagernode.md

# This is the 29th commit message:

Update containers-aspagernode.md

# This is the 30th commit message:

Update containers-aspagernode.md

# This is the 31st commit message:

Update containers-asviewcontroller.md

# This is the 32nd commit message:

Update containers-asviewcontroller.md

# This is the 33rd commit message:

Update containers-asviewcontroller.md

# This is the 34th commit message:

Update containers-asviewcontroller.md

# This is the 35th commit message:

Update containers-overview.md

# This is the 36th commit message:

Update containers-asviewcontroller.md

# This is the 37th commit message:

Update containers-astablenode.md

# This is the 38th commit message:

Update containers-astablenode.md

# This is the 39th commit message:

Update containers-astablenode.md

# This is the 40th commit message:

Update containers-astablenode.md

# This is the 41st commit message:

Update containers-astablenode.md

# This is the 42nd commit message:

Update containers-astablenode.md

# This is the 43rd commit message:

Update containers-astablenode.md

# This is the 44th commit message:

Update containers-astablenode.md
2016-04-19 00:54:31 -07:00

2.0 KiB
Executable File

title, layout, permalink, next
title layout permalink next
ASViewController docs /docs/containers-asviewcontroller.html containers-astablenode.html

ASViewController is a subclass of UIViewController that adds several useful features for hosting ASDisplayNode hierarchies.

An ASViewController can be used in place of any UIViewController - including within a UINavigationController, UITabBarController and UISpitViewController or as a modal view controller.

One of the main benefits to using an ASViewController is to save memory. An ASViewController that goes off screen will automatically reduce the size of the fetch data and display ranges of any of its children. This is key for memory management in large applications.

More features will be added over time, so it is a good idea to base your view controllers off of this class.

A UIViewController provides a view of its own. An ASViewController is assigned a node to manage in its designated initializer initWithNode:.

Consider the following ASViewController subclass PhotoFeedNodeController from the ASDKgram sample app that would like to use a table node as its managed node.

This table node is assigned to the ASViewController in its initWithNode: designated initializer method.

- (instancetype)init
{
  _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
  self = [super initWithNode:_tableNode];
  
  if (self) {
    _tableNode.dataSource = self;
    _tableNode.delegate = self;
  }
  
  return self;
}
If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass `ASViewController`. That is to say, even if you don't use `ASViewController`'s designated initializer `initiWithNode:`, and only use the `ASViewController` in the manner of a traditional `UIVieWController`, this will give you the additional node support if you choose to adopt it in different areas your application.