I am trying to achieve the below attach image on the UITabbar.
我试图在UITabbar上实现下面的附加图像。
It's pretty straight forward, on selection the tab expand with a label to display text and on selection on another tab, the selected tab will collapse.
它非常简单,在选择选项卡时展开标签以显示文本,在另一个选项卡上选择时,所选选项卡将折叠。
I am not really sure how to do this with the UItabbar.
我不确定如何使用UItabbar执行此操作。
I will appreciate if anyone could point me in the right direction.
如果有人能指出我正确的方向,我将不胜感激。
2 个解决方案
#1
1
for the custom tab you use this method on appdelegate class this method create two tab bar item. and you set your image..
对于自定义选项卡,您在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];
}
#2
0
I'm not entirely sure what you're after, however I think this may be relevant to you. You could use the basic concept and tweak it to what you need.
我不完全确定你在追求什么,但我认为这可能与你有关。您可以使用基本概念并根据需要进行调整。
#1
1
for the custom tab you use this method on appdelegate class this method create two tab bar item. and you set your image..
对于自定义选项卡,您在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];
}
#2
0
I'm not entirely sure what you're after, however I think this may be relevant to you. You could use the basic concept and tweak it to what you need.
我不完全确定你在追求什么,但我认为这可能与你有关。您可以使用基本概念并根据需要进行调整。