Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

RootViewController setter creates relationship

  • Loading branch information...
commit a1385fd199fa48039d86ab9515f5576fabeda118 1 parent e538832
@burtlo burtlo authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 PSStackedView/PSStackedViewController.m
View
18 PSStackedView/PSStackedViewController.m
@@ -139,9 +139,7 @@ - (id)initWithRootViewController:(UIViewController *)rootViewController; {
if ((self = [super init])) {
- rootViewController_ = rootViewController;
- objc_setAssociatedObject(rootViewController, kPSSVAssociatedStackViewControllerKey, self, OBJC_ASSOCIATION_ASSIGN); // associate weak
-
+ [self setRootViewController:rootViewController];
[self sharedInitialization];
}
@@ -159,6 +157,20 @@ - (void)dealloc {
}
///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#pragma mark - Root View Controller
+
+- (void)setRootViewController:(UIViewController *)rootViewController {
+
+ if (rootViewController_ != rootViewController) {
+ rootViewController_ = nil;
+
+ rootViewController_ = rootViewController;
+ objc_setAssociatedObject(rootViewController, kPSSVAssociatedStackViewControllerKey, self, OBJC_ASSOCIATION_ASSIGN); // associate weak
+
+ }
+}
+
#pragma mark - Delegate
- (void)setDelegate:(id<PSStackedViewDelegate>)delegate {
Please sign in to comment.
Something went wrong with that request. Please try again.