详解iOS App中UiTabBarController组件的基本用法

2020-01-15 15:08:02于海丽

        UIView *toView = [[self.tabBarController.viewControllers objectAtIndex:selectedIndex + 1] view];

        [UIView transitionFromView:fromView toView:toView duration:0.5f options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {

            if (finished) {

                [self.tabBarController setSelectedIndex:selectedIndex + 1];

            }

        }];

    }

   

}


复制代码
- (IBAction) tappedLeftButton:(id)sender

 

{

    NSUInteger selectedIndex = [self.tabBarController selectedIndex];

   

    if (selectedIndex > 0) {

        UIView *fromView = [self.tabBarController.selectedViewController view];

        UIView *toView = [[self.tabBarController.viewControllers objectAtIndex:selectedIndex - 1] view];

        [UIView transitionFromView:fromView toView:toView duration:0.5f options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {

            if (finished) {

                [self.tabBarController setSelectedIndex:selectedIndex - 1];

            }

        }];

    }


}



注:相关教程知识阅读请移步到IOS开发频道。