开发者

Custom UITabBar that expand on selection

I am trying to achieve the below attach image on the UITabbar.

http://i.imgur.com/7Tukx.png

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.

I will开发者_运维问答 appreciate if anyone could point me in the right direction.


for the custom tab you use this method on appdelegate class this method create two tab bar item. and you set your image..

-(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];
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜