2014-04-12 18:43:41 +00:00
|
|
|
/**
|
2014-05-10 13:18:46 +00:00
|
|
|
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
|
|
|
|
*
|
|
|
|
* See the enclosed file LICENSE for license information (LGPLv3). If you did
|
|
|
|
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
|
|
*
|
|
|
|
* @author Maarten Billemont <lhunath@lyndir.com>
|
|
|
|
* @license http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
|
|
*/
|
2014-04-12 18:43:41 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// MPPasswordsSegue.h
|
|
|
|
// MPPasswordsSegue
|
|
|
|
//
|
|
|
|
// Created by lhunath on 2014-04-12.
|
|
|
|
// Copyright, lhunath (Maarten Billemont) 2014. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MPPasswordsSegue.h"
|
|
|
|
#import "MPPasswordsViewController.h"
|
2014-04-22 03:35:29 +00:00
|
|
|
#import "MPCombinedViewController.h"
|
2014-04-12 18:43:41 +00:00
|
|
|
|
|
|
|
@implementation MPPasswordsSegue {
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination {
|
|
|
|
|
|
|
|
if (!(self = [super initWithIdentifier:identifier source:source destination:destination]))
|
|
|
|
return nil;
|
|
|
|
|
|
|
|
self.animated = YES;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)perform {
|
|
|
|
|
|
|
|
if ([self.destinationViewController isKindOfClass:[MPPasswordsViewController class]]) {
|
|
|
|
__weak MPPasswordsViewController *passwordsVC = self.destinationViewController;
|
2014-05-10 13:18:46 +00:00
|
|
|
MPCombinedViewController *combinedVC = self.sourceViewController;
|
2014-04-22 03:35:29 +00:00
|
|
|
[combinedVC addChildViewController:passwordsVC];
|
2014-04-12 18:43:41 +00:00
|
|
|
passwordsVC.active = NO;
|
2014-05-10 13:18:46 +00:00
|
|
|
|
|
|
|
UIView *passwordsView = passwordsVC.view;
|
2014-09-26 04:32:07 +00:00
|
|
|
passwordsView.frame = combinedVC.view.bounds;
|
|
|
|
passwordsView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
[combinedVC.view insertSubview:passwordsView belowSubview:combinedVC.usersVC.view];
|
2014-05-10 13:18:46 +00:00
|
|
|
|
2014-04-12 18:43:41 +00:00
|
|
|
[passwordsVC setActive:YES animated:self.animated completion:^(BOOL finished) {
|
|
|
|
if (!finished)
|
|
|
|
return;
|
|
|
|
|
2014-04-22 03:35:29 +00:00
|
|
|
[passwordsVC didMoveToParentViewController:combinedVC];
|
2014-04-12 18:43:41 +00:00
|
|
|
}];
|
2014-05-10 13:18:46 +00:00
|
|
|
}
|
|
|
|
else if ([self.sourceViewController isKindOfClass:[MPPasswordsViewController class]]) {
|
2014-04-12 18:43:41 +00:00
|
|
|
__weak MPPasswordsViewController *passwordsVC = self.sourceViewController;
|
|
|
|
|
|
|
|
[passwordsVC willMoveToParentViewController:nil];
|
|
|
|
[passwordsVC setActive:NO animated:self.animated completion:^(BOOL finished) {
|
|
|
|
if (!finished)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[passwordsVC.view removeFromSuperview];
|
|
|
|
[passwordsVC removeFromParentViewController];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|