I want to add Transition animation from ViewController1 to ViewController2. Following picture showing BaseTabBarController and TableViewController. BaseTabBarController has its over .h and .m files named (BaseTabBarController); If i will add any view in base tab bar then it will be added in TableViewController. I am pushing a third ViewController from TableViewController. So in below code, fromVC should be TableViewController but it contains BaseTabBarViewController. I can't able to get any idea what's going on here? Please suggest any solution so that i can move forward. I will be thankful to all of you.
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController <ZoomTransitionProtocol> * fromVC = (id)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController <ZoomTransitionProtocol> *toVC = (id)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView * containerView = [transitionContext containerView];
UIView * fromView = [fromVC view];
UIView * toView = [toVC view];
[containerView addSubview:toView];
UIView * zoomFromView = [fromVC viewForZoomTransition];
UIView * zoomToView = [toVC viewForZoomTransition];
//Code is continuing…
}
I have figured out the issue and its resolved and working perfectly.
Solution: Look into following screenshot:
You will notice that, firstly, Navigation Controller is places and then ViewController; Afterwards, a TabBarController will come; TabBarController's first item is TableViewController; When we push any view controller from any of the tabBar item, it will push because we have root navigation controller; So no need to add separate navigation controllers for each and every tab.
But UITransitionContextFromViewControllerKey will return BaseTabBar classes. So for resolve the issue, i just added a new Navigation Controller for tabBar item. Now it will return correct FromViewCotroller . Following is the correct screenshot:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.