=》UITabbarController, 自定义UITabbar
1. 设置背景
UIImageView *backImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
backImage.image = [UIImage imageNamed:@"barTop.png"];
[_tabController.tabBar insertSubview:backImage atIndex:0];
_tabController.tabBar.opaque = YES;
[backImage release];
2. 代码手动生成UITabbarController
UITabBarController *tabController = [[UITabBarController alloc] init];
tabController.selectedIndex = 0;
UIViewController *c1 = [[UIViewController alloc] init];
c1.tabBarItem.image = [UIImage imageNamed:@"1.png"];
UIViewController *c2 = [[UIViewController alloc] init];
c1.tabBarItem.image = [UIImage imageNamed:@"2.png"];
NSArray *arr = [NAArray arrayWithObjects:c1, c2, nil];
tabController.viewControllers = arr; //设置每个标签的controller
本文介绍了如何使用Objective-C来自定义iOS应用中的UITabBarController。主要包括两部分内容:一是通过代码设置自定义背景图片;二是手动创建并配置UITabBarController及其子控制器。
831

被折叠的 条评论
为什么被折叠?



