remove destination view controller when transition canceled
This commit is contained in:
parent
92fb1d96b8
commit
d3b078e984
@ -106,10 +106,7 @@
|
|||||||
|
|
||||||
// Replaces the current view controller.
|
// Replaces the current view controller.
|
||||||
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationObject.navigationController.viewControllers];
|
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationObject.navigationController.viewControllers];
|
||||||
if (viewControllers.count > 1) {
|
[viewControllers replaceObjectAtIndex:([self.navigationObject.navigationController.viewControllers count] - 1) withObject:self.navigationObject.viewController];
|
||||||
[viewControllers removeObjectAtIndex:0];
|
|
||||||
}
|
|
||||||
[viewControllers replaceObjectAtIndex:(viewControllers.count - 1) withObject:self.navigationObject.viewController];
|
|
||||||
[self setViewControllers:viewControllers];
|
[self setViewControllers:viewControllers];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -262,8 +259,10 @@
|
|||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
|
||||||
if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) {
|
if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) {
|
||||||
BOOL transitionStoped = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue;
|
BOOL transitionCanceled = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue;
|
||||||
if (transitionStoped) {
|
if (transitionCanceled) {
|
||||||
|
//When interactive transition canceled, the destination viewController should be removed from navigationController
|
||||||
|
[self.navigationObject.viewController removeFromParentViewController];
|
||||||
[self markAsFinished];
|
[self markAsFinished];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user