Skip to content

Commit f48b39c

Browse files
committed
After some more careful thought: the center does not need the finish transition blocks.
1 parent f8a8af5 commit f48b39c

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

ViewDeck/IIViewDeckController.m

+23-27
Original file line numberDiff line numberDiff line change
@@ -3086,34 +3086,30 @@ - (void)setCenterController:(UIViewController *)centerController {
30863086
_centerController = centerController;
30873087

30883088
if (_centerController) {
3089-
// and finish the transition
3090-
void(^finishTransition)(void) = ^{
3091-
[self addChildViewController:_centerController];
3092-
[_centerController setViewDeckController:self];
3093-
[_centerController addObserver:self forKeyPath:@"title" options:0 context:nil];
3094-
self.title = _centerController.title;
3095-
if (self.automaticallyUpdateTabBarItems) {
3096-
[_centerController addObserver:self forKeyPath:@"tabBarItem.title" options:0 context:nil];
3097-
[_centerController addObserver:self forKeyPath:@"tabBarItem.image" options:0 context:nil];
3098-
[_centerController addObserver:self forKeyPath:@"hidesBottomBarWhenPushed" options:0 context:nil];
3099-
self.tabBarItem.title = _centerController.tabBarItem.title;
3100-
self.tabBarItem.image = _centerController.tabBarItem.image;
3101-
self.hidesBottomBarWhenPushed = _centerController.hidesBottomBarWhenPushed;
3102-
}
3103-
3104-
[_centerController view]; // make sure the view is loaded before calling viewWillAppear:
3105-
[self applyCenterViewOpacityIfNeeded];
3106-
[self applyCenterViewCornerRadius];
3107-
afterBlock(_centerController);
3108-
[_centerController didMoveToParentViewController:self];
3109-
3110-
if ([self isAnySideOpen]) {
3111-
[self centerViewHidden];
3112-
}
3113-
};
3089+
II_RETAIN(_centerController);
3090+
[_centerController willMoveToParentViewController:self];
3091+
[self addChildViewController:_centerController];
3092+
[_centerController setViewDeckController:self];
3093+
[_centerController addObserver:self forKeyPath:@"title" options:0 context:nil];
3094+
self.title = _centerController.title;
3095+
if (self.automaticallyUpdateTabBarItems) {
3096+
[_centerController addObserver:self forKeyPath:@"tabBarItem.title" options:0 context:nil];
3097+
[_centerController addObserver:self forKeyPath:@"tabBarItem.image" options:0 context:nil];
3098+
[_centerController addObserver:self forKeyPath:@"hidesBottomBarWhenPushed" options:0 context:nil];
3099+
self.tabBarItem.title = _centerController.tabBarItem.title;
3100+
self.tabBarItem.image = _centerController.tabBarItem.image;
3101+
self.hidesBottomBarWhenPushed = _centerController.hidesBottomBarWhenPushed;
3102+
}
3103+
3104+
[_centerController view]; // make sure the view is loaded before calling viewWillAppear:
3105+
[self applyCenterViewOpacityIfNeeded];
3106+
[self applyCenterViewCornerRadius];
3107+
afterBlock(_centerController);
3108+
[_centerController didMoveToParentViewController:self];
31143109

3115-
II_RETAIN(centerController);
3116-
[self enqueueFinishTransitionBlock:finishTransition forController:centerController];
3110+
if ([self isAnySideOpen]) {
3111+
[self centerViewHidden];
3112+
}
31173113
}
31183114
}
31193115

0 commit comments

Comments
 (0)