Files
AsyncDisplayKit/_docs/containers-asviewcontroller.md
2016-04-18 00:05:28 -07:00

1.3 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 and adds the following features

  • measurement handling
  • additional memory management to help deep nativation stacks manage memory

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

###Porting UIViewControllers to ASViewControllers### 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 that would like to use a custom table node as its managed node.

- (instancetype)initWithModel:(NSArray *)models
{
    ASTableNode *tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];

    if (!(self = [super initWithNode:tableNode])) { return nil; }

    self.models = models;
    
    self.tableNode = tableNode;
    self.tableNode.dataSource = self;
    
    return self;
}

For a full guide on porting your UIKit app to ASDK see Porting Your App (INCLUDE LINK).

###Example Apps###