我通过故事板使用UITabbarController实现SWRevealViewController.
我想在第一个UITabBarItem中显示SWRevealViewController,在其他UITabBarItem中我不想打开完全完成的SWRevealViewController.
但问题是当SWRevealViewController出现时,UITabBar的位置不像viewcontroller那样改变.
我想在第一个UITabBarItem中显示SWRevealViewController,在其他UITabBarItem中我不想打开完全完成的SWRevealViewController.
但问题是当SWRevealViewController出现时,UITabBar的位置不像viewcontroller那样改变.
请帮我.
解决方法
我通过使用SWRevealViewController委托方法手动更改UITabbar的位置来解决问题.
将此代码放在MenuViewController中.
将此代码放在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.size.height); } else { _tabBar.frame = CGRectMake(0,_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.size.height); }
原文地址:https://www.jb51.cc/iOS/334137.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。