0

I saw in the documentation that I can set the tabBarItem property of each view controller that is associated with my tabBarController. I can set the title and I can set the image.

But I don't understand how to set it to a UITabBarSystemItem, which would show something like a search icon (UITabBarSystemItemSearch).

Can I set the image using a system item for some tabBarItems and use my own custom title and image for others?

Jim
  • 5,940
  • 9
  • 44
  • 91
  • possible duplicate of [Programatic Creation and Config of UITabBarController - Setting a system Image for a tab](http://stackoverflow.com/questions/4693156/programatic-creation-and-config-of-uitabbarcontroller-setting-a-system-image-f) – rob mayoff Dec 11 '11 at 06:26

1 Answers1

1
myViewController.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:7];
rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • Should I release the current tabBarItem before assigning a new instance to it? – Jim Dec 11 '11 at 06:32
  • No, but if you're not using ARC, you should release (or autorelease) the new `UITabBarItem` *after* assigning it to `myViewController.tabBarItem`. – rob mayoff Dec 11 '11 at 08:36