Pra*_*iya 8 objective-c uitabbarcontroller uitabbar ios swrevealviewcontroller
我通过故事板实现了SWITeveViewController和UITabbarController.我想在第一个UITabBarItem中显示SWRevealViewController,在其他UITabBarItem中我不想打开完全完成的SWRevealViewController.但问题是当SWRevealViewController出现时,UITabBar的位置不像viewcontroller那样改变.
请帮我.
UITabbar我通过手动使用委托方法更改位置来解决问题SWRevealViewController。将这段代码放入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);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
376 次 |
| 最近记录: |