mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-06 22:34:04 +08:00
44 lines
1.3 KiB
Markdown
Executable File
44 lines
1.3 KiB
Markdown
Executable File
---
|
|
title: ASViewController
|
|
layout: docs
|
|
permalink: /docs/containers-asviewcontroller.html
|
|
next: containers-astablenode.html
|
|
---
|
|
|
|
`ASViewController` is a subclass of `UIViewController` and adds the following features
|
|
<ul>
|
|
<li>measurement handling</li>
|
|
<li>additional memory management to help deep nativation stacks manage memory</li>
|
|
</ul>
|
|
|
|
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###
|
|
|
|
|
|
|
|
|