首页 文章

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

提问于
浏览
3

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

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

1 回答

  • 8

    使用 - (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag 创建UITabBarItem .
    对于可能的UITabBarSystemItem值,请查看UITabBarItem类引用,'Constants' section .

相关问题