自定义UITabBarController
来源:互联网 发布:php接口interface 编辑:程序博客网 时间:2024/06/10 15:50
aaaViewController *aa = [[aaaViewController alloc] init];
UINavigationController* ayNav = [[UINavigationController alloc]initWithRootViewController:aa];
aaaViewController *bb = [[aaaViewController alloc] init];
UINavigationController* bNav = [[UINavigationController alloc]initWithRootViewController:bb];
aaaViewController *cc = [[aaaViewController alloc] init];
UINavigationController* cNav = [[UINavigationController alloc]initWithRootViewController:cc];
UITabBarController *tabBarController = [[UITabBarController alloc]init];
tabBarController.viewControllers=[[NSArray alloc]initWithObjects:ayNav,bNav,cNav,nil];
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *aTabBarItem = [tabBar.items objectAtIndex:0];
UITabBarItem *bTabBarItem = [tabBar.items objectAtIndex:1];
UITabBarItem *cTabBarItem = [tabBar.items objectAtIndex:2];
aTabBarItem.title = @"aaa";
bTabBarItem.title = @"bbb";
aTabBarItem.selectedImage=[[UIImage imageNamed:@"menu01_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
aTabBarItem.image=[[UIImage imageNamed:@"menu01_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
bTabBarItem.selectedImage=[[UIImage imageNamed:@"menu02_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
bTabBarItem.image=[[UIImage imageNamed:@"menu02_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
cTabBarItem.selectedImage=[[UIImage imageNamed:@"menu03_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
cTabBarItem.image=[[UIImage imageNamed:@"menu03_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage* tabBarBackground = [UIImage imageNamed:@"navi_44.png"];
[[UITabBar appearance]setBackgroundImage:tabBarBackground];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor], NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
tabBarController.selectedIndex=1;
self.window.rootViewController = tabBarController;
UINavigationController* ayNav = [[UINavigationController alloc]initWithRootViewController:aa];
aaaViewController *bb = [[aaaViewController alloc] init];
UINavigationController* bNav = [[UINavigationController alloc]initWithRootViewController:bb];
aaaViewController *cc = [[aaaViewController alloc] init];
UINavigationController* cNav = [[UINavigationController alloc]initWithRootViewController:cc];
UITabBarController *tabBarController = [[UITabBarController alloc]init];
tabBarController.viewControllers=[[NSArray alloc]initWithObjects:ayNav,bNav,cNav,nil];
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *aTabBarItem = [tabBar.items objectAtIndex:0];
UITabBarItem *bTabBarItem = [tabBar.items objectAtIndex:1];
UITabBarItem *cTabBarItem = [tabBar.items objectAtIndex:2];
aTabBarItem.title = @"aaa";
bTabBarItem.title = @"bbb";
cTabBarItem.title = @"ccc";
aTabBarItem.selectedImage=[[UIImage imageNamed:@"menu01_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
aTabBarItem.image=[[UIImage imageNamed:@"menu01_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
bTabBarItem.selectedImage=[[UIImage imageNamed:@"menu02_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
bTabBarItem.image=[[UIImage imageNamed:@"menu02_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
cTabBarItem.selectedImage=[[UIImage imageNamed:@"menu03_focused.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
cTabBarItem.image=[[UIImage imageNamed:@"menu03_default.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage* tabBarBackground = [UIImage imageNamed:@"navi_44.png"];
[[UITabBar appearance]setBackgroundImage:tabBarBackground];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor], NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
tabBarController.selectedIndex=1;
self.window.rootViewController = tabBarController;
0 0
- 自定义UITabBarController
- 自定义UITabBarController
- 自定义UITabBarController
- 自定义UITabBarController
- 自定义UITabBarController
- 自定义UITabBarController
- 自定义 UITabbarController
- 自定义UITabBarController
- UITabBarController详解(三)自定义UITabBarController
- 自定义UITabBarController简单方法
- UITabBarController自定义标签栏
- UITabBarController自定义(一)
- UITabBarController中自定义UITabBar
- IOS自定义UITabBarController
- UITabBarController自定义以及隐藏
- iOS--自定义UITabBarController
- 使用UIViewController自定义UITabBarController
- 关于UITabBarController (非自定义)
- abercrombie france large-scale comprehensive tests have been in full swing.According introduction
- 我若不来,怎与你相遇,你若不来,怎可与我结识?一场繁华,待落尽,谁是谁的梦?谁又是谁的客?一朵花,随缘而绽,缘来如夏花般灿烂,缘去如秋叶般静美,这是怎样的情愫?入夜,月凉如水,如水凉月,捻一缕青烟,让
- 网站获取非根目录下面的文件---虚拟路径
- SpringMVC 用JackJson做接口返回JSON格式指定的字段解决方法
- 如何编写bat文件并打包java项目
- 自定义UITabBarController
- 元素垂直居中与hover失效
- android 在布局上绘制大量的基本的集合图形。
- Qt中QString,int,char,QByteArray之间相互转换
- RowEditing总结
- javamail实例之获取邮件,包括gmail yahoo
- 网站出现403 Forbidden
- hdu4865(概率DP)
- [hdu 5072]Coprime 数论-莫比乌斯反演