简体   繁体   English

在ViewController iOS中翻转TabBar和subView

[英]Flip the TabBar and subView in ViewController iOS

I am working on an app which is using UITabBarController . 我正在使用UITabBarController的应用程序上工作。 At some point, I have to flip the view and the whole tabbar and also have to update the tabbar items. 在某些时候,我必须翻转视图和整个tabbar ,还必须更新tabbar项。

To flip the views without tabbar , I have used this: 要翻转不带tabbar的视图,我使用了以下方法:

-(IBAction)flipView:(id)sender {

    if (self.isSignUpViewOnDisplay == YES) {

        [self.signUpView setHidden:YES];
        [self.signUpView setHidden:NO];

        [UIView transitionFromView:self.signUpView toView:self.signInView
                          duration:1.0
                           options:UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionShowHideTransitionViews
                        completion:NULL];
        self.isSignUpViewOnDisplay = NO;
    }
    else {

        [self.signUpView setHidden:NO];
        [self.signUpView setHidden:YES];

        [UIView transitionFromView:self.signInView toView:self.signUpView
                          duration:1.0
                           options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionShowHideTransitionViews
                        completion:NULL];
        self.isSignUpViewOnDisplay = YES;
    }
}

And it works perfectly. 而且效果很好。 Now, I am inside a tabbar and I have to flip it. 现在,我在tabbar ,必须翻转它。 By using same code, I cannot see the flip animation. 通过使用相同的代码,我看不到翻转动画。 Although, tabbar is updated and its simple. 虽然, tabbar已更新且简单。

How I can flip the whole tabbar with current controller? 如何使用当前控制器翻转整个tabbar

You can simply flip it with tabBarController.tabBar 您可以简单地使用tabBarController.tabBar翻转它

UIView * a = self.tabBarController.tabBar;

[UIView transitionFromView:toolbar
                    toView:a
                  duration:0.5
                   options:UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionShowHideTransitionViews
                completion:^(BOOL finished)
 {

 }];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM