如何使用Apple自定义UITabBarItem图像?
Apple 在视图控制器编程指南中提供了一个示例,用于创建 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 的内置图形作为选项卡栏项目。我怎么能这么做呢?可用图标及其名称的列表在哪里?
Apple has provided an example the View Controller Programming Guide, for creating an UITabBarItem, like this:
- (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;
}
However, I am a graphic-noob and want to use Apple's built in graphics for Tab Bar Items. How could I do that? Where is a list of the available icons and their names?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag
创建 UITabBarItem。对于可能的 UITabBarSystemItem 值,请查看 UITabBarItem 类参考的“常量”部分。
Use
- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag
to create UITabBarItem.For possible UITabBarSystemItem values look in UITabBarItem class reference, 'Constants' section.