【发布时间】:2011-02-14 11:08:19
【问题描述】:
我在使用 UITabBar 时遇到了一些问题,并且在网上找不到任何关于该主题的内容。几乎我想显示一个视图(比如TestView)和一个包含其他视图的TabBar:绿色视图和红色视图。因此,最初我希望 TestView 在底部显示一个带有 2 个选项卡的 tabBar,一个用于绿色视图,一个用于红色视图,一旦触摸其中一个选项卡,就会显示适当的视图,但不会有选项卡用于测试视图
但这是 MainAppDelegate 代码和我得到的图片
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Create the TabBar VC and ButtonSelect VC
testView = [[TestViewController alloc] init];
tabBarController = [[UITabBarController alloc] init];
//Create the viewcontroller's For the TabBarController
UIViewController *gvc = [[GreenViewController alloc] init];
UIViewController *rvc = [[RedViewController alloc] init];
//Make a array to containing the two viewcontrollers (for TabBar)
NSArray *viewControllers = [NSArray arrayWithObjects:gvc, rvc, nil];
//Attach the VC's to the TabBar
[tabBarController setViewControllers:viewControllers];
//Set to window
[window addSubview:[tabBarController view]];
[window addSubview:[testView view]];
[window makeKeyAndVisible];
[rvc release];
[gvc release];
return YES;
}
我得到的是This..
请帮忙
【问题讨论】:
标签: iphone objective-c uiviewcontroller uitabbarcontroller tabbar