-4

I know how to add UITabBarController and how it is used, I already done it.

My Problem is that I am not able to add image on 'more' tab of UITabBarController.
I know there are many similar questions as mine but did not help me.
After googling I found that we can't add images on 'More' tab in UITabBarController Because more tab is automatically displayed by UITabBarController when UITabBarItem is more Then 5.
I could find how to change SELECTION COLOR AND TITLE OF 'more' button, But I could not find about 'more' button Image.

So may be I need to customize UITabBarController so, I am also searching for customization of UITabBarController but could not find it.

Please help me on this Issue.

Pratyusha Terli
  • 2,343
  • 19
  • 31
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • More button is automatically generate when tabs are more than 5 in iPhone .... So you cant do that ... instead you should make a custom tabbar with the help of `UIView` and `UIButton`s ... – TheTiger Jun 26 '13 at 04:20
  • @TheTiger- thanks for replay... i also tried to found custom tabBarController but i can not find it, if you have any link of source of code that please put here ..:) – iPatel Jun 26 '13 at 04:22
  • check it and let me know if it is your demand http://tinypic.com/view.php?pic=2q2fuvp&s=5 then i will share code with you. – jamil Jun 26 '13 at 04:43
  • @BobApple- yes exactly i want this types of UITabBarController. please share code :) – iPatel Jun 26 '13 at 04:47
  • did you solved the issue? – jamil Jun 26 '13 at 05:54
  • @BobApple- nope :( please put your code as answer ..it is very very important to me :) – iPatel Jun 26 '13 at 05:56
  • ok let me show you code:) – jamil Jun 26 '13 at 05:57
  • first take a look http://stackoverflow.com/a/12572336/1328096 because i have using nearly same way like this but still if you face any problem then let me know. – jamil Jun 26 '13 at 06:12
  • i think still you did not solve the problem. if you want to customize the tabbar like the image i show you then why you not following the approach i mentioned. – jamil Jun 26 '13 at 09:44
  • @iPatel - Please accept any answer. – TheTiger Jul 19 '13 at 04:19

3 Answers3

5

More button is automatically generate when tabs are more than 5 in iPhone. So you can't do that. Instead you should make a custom tabbar with the help of UIView and UIButtons.

See how to add UIViewController's view on self.view.

[self addChildViewController:yourViewController];
yourViewController.view.frame = anyFrame;
[self addSubview:yourViewController.view];
[yourViewController didMoveToParentViewController:self];

By this you can add different UIViewController on each button's click. All the best! 

Well If you dont want to create it yourself. Below is the list of custom tabbars find the one which suits your requirement.

  1. AKTabBarController
  2. InfiniTabBar
  3. RaisedCenterTabBar
  4. MHTabBarController
  5. TweetBotTabBar
  6. ALCustomTabBarController
  7. MHCustomTabBarController
  8. M13InfiniteTabBar
  9. TabBarKit
  10. RNSwipeBar
  11. BCTabBarController
  12. TabBarAnimation
  13. ExpandableTabBar
  14. JBTabBarController
  15. JSScrollableTabBar
  16. NGTabBarController
  17. crtabbar
  18. VSTabBar
  19. DMFilterView
  20. CubeTabBarController
  21. FSVerticalTabBarController
  22. PrettyKit
TheTiger
  • 13,264
  • 3
  • 57
  • 82
2

You can add an image for each item , for the selected and unselected states. Like this:

UIImage *selectedImage0     = [UIImage imageNamed:@"image1.png"];
UIImage *unselectedImage0   = [UIImage imageNamed:@"image1_unselected.png"];

UIImage *selectedImage1     = [UIImage imageNamed:@"image2.png"];
UIImage *unselectedImage1   = [UIImage imageNamed:@"image2_unselected.png"];

UIImage *selectedImage2     = [UIImage imageNamed:@"image3.png"];
UIImage *unselectedImage2   = [UIImage imageNamed:@"image3_unselected.png"];

UIImage *selectedImage3     = [UIImage imageNamed:@"image4.png"];
UIImage *unselectedImage3   = [UIImage imageNamed:@"image4_unselected.png"];

UIImage *selectedImage4     = [UIImage imageNamed:@"image5.png"];
UIImage *unselectedImage4   = [UIImage imageNamed:@"image5_unselected.png"];

UITabBar     *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0  = [tabBar.items objectAtIndex:0];
UITabBarItem *item1  = [tabBar.items objectAtIndex:1];
UITabBarItem *item2  = [tabBar.items objectAtIndex:2];
UITabBarItem *item3  = [tabBar.items objectAtIndex:3];
UITabBarItem *item4  = [tabBar.items objectAtIndex:4];

[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3];
[item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4];

You can place this code in the viewDidLoad method of any of your controllers.

Hope it works for you thanks!

jamil
  • 2,419
  • 3
  • 37
  • 64
  • Thanks for replay dude, may be you can't get my Question clearly.. I want to change image of 'more' button that by default come with UITabBarController and it would display when you have more than 5 tabBarItems.. :) – iPatel Jun 26 '13 at 06:48
  • you only want to change the image of more tabbar item? but then what will do for others tabbar items.i think you need to Customize all the tabbar items this is only way you can change the image of more button. – jamil Jun 26 '13 at 07:01
1

Try to create more than 5 segues from TabBarController to others and than you will see more button. Add images on the TabBar item of each controller you were connected and you will see this tabbar item's icon on the main TabBar

LIAL
  • 1,624
  • 4
  • 24
  • 30
  • sorry i can not understand your answer... i have 6 TabBarItem and i also added image to each TabBarItem but but it not helpful to display image on more button :( – iPatel Jun 26 '13 at 04:26