I implement SWRevealViewController with UITabbarController via storyboard. I want to display SWRevealViewController in first UITabBarItem only, in other UITabBarItem i don't want to open SWRevealViewController, that done completely. But problem is position of UITabBar is not change like viewcontroller while SWRevealViewController is appear.
Please help me.
Storyboard structure
I solve the problem by change position of UITabbar
manually using SWRevealViewController
delegate method.
Put this code in MenuViewController
.
MenuViewController.m
- (void) viewDidLoad {
[super viewDidLoad];
UITabBarController *tbc = (UITabBarController *)[[[[UIApplication sharedApplication]delegate]window]rootViewController];
self.tabBar = tbc.tabBar;
_tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height);
self.revealViewController.delegate = self;
}
- (void) revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position {
if (position == FrontViewPositionRight) {
_tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height);
}
else {
_tabBar.frame = CGRectMake(0, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height);
}
}
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress {
_tabBar.frame = CGRectMake(self.revealViewController.rearViewRevealWidth * progress, _tabBar.frame.origin.y, _tabBar.frame.size.width, _tabBar.frame.size.height);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With