Merge pull request #2625 from MarvinNazari/master

[ASCellNode] implement a .viewController property
This commit is contained in:
Adlai Holler
2016-11-19 15:49:32 +09:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -116,6 +116,13 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
*/
@property (nonatomic, readonly, nullable) NSIndexPath *indexPath;
/**
* The backing view controller, or @c nil if the node wasn't initialized with backing view controller
* @note This property must be accessed on the main thread.
*/
@property (nonatomic, readonly, nullable) UIViewController *viewController;
/**
* The owning node (ASCollectionNode/ASTableNode) of this cell node, or @c nil if this node is
* not a valid item inside a table node or collection node or if those nodes are nil.

View File

@@ -236,6 +236,17 @@ static NSMutableSet *__cellClassesForVisibilityNotifications = nil; // See +init
return nil;
}
- (UIViewController *)viewController
{
ASDisplayNodeAssertMainThread();
// Force the view to load so that we will create the
// view controller if we haven't already.
if (self.isNodeLoaded == NO) {
[self view];
}
return _viewController;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"