Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CLFContainerViewController/CLFStackContainerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ typedef NS_ENUM(NSUInteger, CLFStackContainerPushPopDirections) {
@property (readonly, nonatomic) UIViewController *rootViewController;
@property (readonly, nonatomic) UIViewController *topViewController;

// This overrides readonly property in base class and make possible to replace view controllers hierarchies dynamically
// (similiar to UINavigationController)
@property (readwrite, nonatomic) NSArray *viewControllers;

// The default implementation uses this property to determine which
// animations to use for the pushes and pops.
//
Expand Down
21 changes: 21 additions & 0 deletions CLFContainerViewController/CLFStackContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ - (UIViewController *)topViewController
}


- (void)setViewControllers:(NSArray *)controllers
{
NSAssert([controllers count] > 0, @"CLFStackContainerViewController should has at least one controller!");

NSArray *controllersToRemove = [self.viewControllers copy];

for (UIViewController *controller in controllers)
[super addViewController:controller];

[super switchToViewController:[controllers lastObject]
animated:NO
preAnimationSetup:NULL
animations:nil
animationDurations:nil
animationOptions:nil
completionBlock:^(BOOL finished) {
for (UIViewController *controller in controllersToRemove)
[super removeViewController:controller];
}];
}

- (void (^)())transitionUpPreAnimationBlock
{
return ^{
Expand Down