侧滑菜单
ios分类:iOS界面布局
DDMenu(传统侧滑效果)下载地址:https://github.com/dangxiaoyin/DDMenu
WWSideslip(高仿QQ侧滑效果)下载地址:https://github.com/dangxiaoyin/SideslipView
RXLSideSlip (推荐使用) 下载地址:https://github.com/dangxiaoyin/RXLSideSlip
- (void)mainTabBar
{
AppDelegate*app = (AppDelegate*)[UIApplication sharedApplication].delegate;
HomeViewController*mainVC = [[HomeViewController alloc]init];
mainVC.tabBarItem.title=MAIN_PAGE;
mainVC.tabBarItem.image= [UIImage imageNamed:@"main_page_high"];
mainVC.tabBarItem.selectedImage= [UIImage imageNamed:@"main_page"];
UINavigationController*mainNav = [[UINavigationController alloc]initWithRootViewController:mainVC];
MedicalCircleViewController*medicalVC = [[MedicalCircleViewController alloc]init];
medicalVC.tabBarItem.title=MAIN_STUDY;
medicalVC.tabBarItem.image= [UIImage imageNamed:@"study"];
medicalVC.tabBarItem.selectedImage= [UIImage imageNamed:@"study_high"];
UINavigationController*medicalNav = [[UINavigationController alloc]initWithRootViewController:medicalVC];
InformationViewController*infoVC = [[InformationViewController alloc]init];
infoVC.tabBarItem.title=MAIN_MEDICAL;
infoVC.tabBarItem.image= [UIImage imageNamed:@"medical_exam"];
infoVC.tabBarItem.selectedImage= [UIImage imageNamed:@"medical_exam_high"];
UINavigationController*infoNav = [[UINavigationController alloc]initWithRootViewController:infoVC];
MineViewController*mineVC = [[MineViewController alloc]init];
mineVC.tabBarItem.title=MAIN_MINE;
mineVC.tabBarItem.image= [UIImage imageNamed:@"mine"];
mineVC.tabBarItem.selectedImage= [UIImage imageNamed:@"mine_high"];
UINavigationController*mineNav = [[UINavigationController alloc]initWithRootViewController:mineVC];
UITabBarController*tabBarControl = [[UITabBarController alloc]init];
tabBarControl.viewControllers= @[mainNav,medicalNav,infoNav,mineNav];
tabBarControl.tabBar.barStyle=UIBarStyleDefault;
tabBarControl.view.backgroundColor= [UIColor whiteColor];
tabBarControl.tabBar.tintColor= [UIColor colorWithHexString:@"#238E23"];//设置高亮颜色
tabBarControl.selectedIndex=self.selectedIndex;
//app.window.rootViewController = tabBarControl;
/**
*
* @侧滑菜单
* @效果一
* @传统效果
*
*/
DDMenuController*ddMenu = [[DDMenuController alloc]initWithRootViewController:tabBarControl];
SideslipViewController*left = [[SideslipViewController alloc]init];
ddMenu.leftViewController= left;
SideslipRightViewController*right = [[SideslipRightViewController alloc]init];
ddMenu.rightViewController= right;
app.window.rootViewController= ddMenu;
/**
*
* @侧滑菜单
* @效果二
* @高仿QQ
* @缺点 : 手势干扰导致点击Tab响应不灵敏
*
*/
WWSideslipViewController* slide = [[WWSideslipViewControlleralloc]initWithLeftView:leftandMainView:tabBarControlandRightView:rightandBackgroundImage:[UIImage imageNamed:@"SlidslipGround"]];
//滑动速度系数
[slidesetSpeedf:0.7];
//点击视图是是否恢复位置
slide.sideslipTapGes.enabled=YES;
app.window.rootViewController= slide;
}
/**
*
* @侧滑菜单仿QQ
* @效果三
* @动画效果
*
*/
SideslipViewController*left = [[SideslipViewController alloc]init];
SideslipRightViewController*right = [[SideslipRightViewController alloc]init];
RXLSideSlipViewController*RXL = [[RXLSideSlipViewController alloc]initWithContentViewController:tabBarControlleftMenuViewController:leftrightMenuViewController:right];
//RXL.backgroundImage = [UIImage imageNamed:@"aaa.png"];
//RXL.delegate = self;
RXL.menuPreferredStatusBarStyle= 1;// UIStatusBarStyleLightContent
RXL.contentViewShadowColor= [UIColor blackColor];
RXL.contentViewShadowOffset=CGSizeMake(0, 0);
RXL.contentViewShadowOpacity= 0.6;
RXL.contentViewShadowRadius= 12;
RXL.contentViewShadowEnabled=NO;//是否显示阴影
RXL.contentPrefersStatusBarHidden=NO;//是否隐藏主视图的状态条
app.window.rootViewController= RXL;