如何使用Apple自定义UITabBarItem图像?

ope*_*rog 3 iphone uitabbarcontroller uitabbaritem

Apple提供了一个View Controller Programming Guide的示例,用于创建UITabBarItem,如下所示:

- (id)init {
   if (self = [super initWithNibName:@"MyViewController" bundle:nil]) {
      self.title = @"My View Controller";

      UIImage* anImage = [UIImage imageNamed:@"MyViewControllerImage.png"];
      UITabBarItem* theItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:anImage tag:0];
      self.tabBarItem = theItem;
      [theItem release];
   }
   return self;
}
Run Code Online (Sandbox Code Playgroud)

但是,我是一个平面菜鸟,想要使用Apple的内置图形用于Tab Bar项目.我怎么能这样做?可用图标及其名称的列表在哪里?

Vla*_*mir 8

使用- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag创建UITabBarItem.
对于可能的UITabBarSystemItem值,请查看UITabBarItem类引用,"常量"部分.