我正在尝试在UITabbar上实现以下附加图像。
非常简单,在选择选项卡时展开标签以显示文本,在另一个标签上选择时,所选标签将会折叠。
我不确定如何使用UItabbar执行此操作。
如果有人能指出我正确的方向,我将不胜感激。
答案 0 :(得分:1)
对于自定义选项卡,您在appdelegate类上使用此方法 此方法创建两个标签栏项。 并设置你的形象..
-(void)SetTabs
{
tabBarController = [[UITabBarController alloc]init];
NSMutableArray *localControllerArray = [[NSMutableArray alloc]initWithCapacity:2];
UIImage *image = [UIImage imageNamed:@"home.png"];
GreetingCardsViewController *GreetingCardsView = [[[GreetingCardsViewController alloc] initWithNibName:@"GreetingCardsViewController" bundle:nil] autorelease];
UITabBarItem *item = [[UITabBarItem alloc]initWithTitle:@"Home" image:image tag:0];
UINavigationController *GreetingCardsViewNavigationController = [[UINavigationController alloc]initWithRootViewController:GreetingCardsView];
GreetingCardsView.tabBarItem = item;
[localControllerArray addObject:GreetingCardsViewNavigationController];
UIImage *image1 = [UIImage imageNamed:@"heart1.png"];
Cards *CardView = [[[Cards alloc] initWithNibName:@"Cards" bundle:nil] autorelease];
UITabBarItem *item1 = [[UITabBarItem alloc]initWithTitle:@"Cards" image:image1 tag:1];
UINavigationController *CardNavigationController = [[UINavigationController alloc]initWithRootViewController:CardView];
CardNavigationController.tabBarItem = item1;
[localControllerArray addObject:CardNavigationController];
[tabBarController setViewControllers:localControllerArray];
[_window addSubview:tabBarController.view];
[localControllerArray release];
}
答案 1 :(得分:0)
我不完全确定您的目标是什么,但我认为this可能与您相关。您可以使用基本概念并根据需要进行调整。