我使用的是UITabBar,但它没有显示项目的标题。我做错了什么?
这是我正在使用的示例:
UITabBar *menu = [[UITabBar alloc] initWithFrame:CGRectMake(0, 480 - 100, 320, 100)];
NSMutableArray *items = [[NSMutableArray alloc] init];
UITabBarItem *item = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemRecents tag:0];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 1" image:[UIImage imageNamed:@"test1.png"] tag:1];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 2" image:[UIImage imageNamed:@"test2.png"] tag:2];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 3" image:[UIImage imageNamed:@"test3.png"] tag:2];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 4" image:[UIImage imageNamed:@"test4.png"] tag:2];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 5" image:[UIImage imageNamed:@"test5.png"] tag:2];
[items addObject:item];
[item release];
item = [[UITabBarItem alloc] initWithTitle:@"item 6" image:[UIImage imageNamed:@"test6.png"] tag:3];
[items addObject:item];
[item release];
[menu setItems:items animated:false];
[[self view] addSubview:menu];
[menu release];