2013-02-11 64 views
0

什么是创建一个完全自定义的UITabBarController看起来很相像的最佳途径。定制的UITabBarController - 最好的办法

我需要它的大小完全定制,制作动画等

,我只是用UIView为tabbarcontroller是那么代替它上面的UIView上对UIView选择什么按钮取决于一个解决方案。

什么是最好的方法?

+1

如果您一次选择行为的某个方面 - 您想要在课堂上改进某些内容,然后在关于该问题的问题中发布代码,那么您可能会进一步了解这一点。很多人会跳进来帮助你。否则,他们可能会看到这个问题,只是耸耸肩。 – danh 2013-02-11 15:33:56

回答

0

这是一个很好的指南正是这样做的: http://www.felipecypriano.com/2012/02/27/how-to-customize-uitabbar-on-ios-5/

这个例子是从该网站采取:

基本上创建和backgroundImage,selectionIndicatorImage,调整字体为适当。

// Probably put these in your AppDelegate, setup the background and selection image 
[[[self tabBarController] tabBar] setBackgroundImage:[UIImage imageNamed:@"background"]]; 
[[[self tabBarController] tabBar] setSelectionIndicatorImage:[UIImage imageNamed:@"selected"]]; 

// In your VC which is inside the tab bar 
- (id)init { 
    self = [super initWithNibName:@"MyNibName" bundle:nil]; 
    if (self) { 
     self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"The Title" image:nil tag:0]; 
     [[self tabBarItem] setFinishedSelectedImage:[UIImage imageNamed:@"tab_icon"] withFinishedUnselectedImage:[UIImage imageNamed:@"tab_icon"]]; 
     [[self tabBarItem] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil] forState:UIControlStateNormal]; 
    } 
}