iPhone开发札记【2011.11.02】

来源:互联网 发布:变体美术字设计软件 编辑:程序博客网 时间:2024/06/02 22:12

=》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






原创粉丝点击