以编程方式创建了一个TabBar控制器 - 但是xib文件在哪里?

时间:2012-06-02 18:01:13

标签: objective-c cocoa-touch uiviewcontroller

我实现了一个TabBar控制器,就像这样

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
     firstView = [[FirstView alloc]init];
     secondView = [[SecondView alloc]init];

     firstItem = [[UITabBarItem alloc]initWithTitle:@"First" image:nil tag:0];
     secondItem = [[UITabBarItem alloc]initWithTitle:@"Second" image:nil tag:1];

     firstView.tabBarItem = firstItem;
     secondView.tabBarItem = secondItem;


     NSArray *viewArray = [[NSArray alloc]initWithObjects:firstView, secondView, nil];
     [self setViewControllers:viewArray];
    }
return self;
}

在AppDidFinishedLoading中,我刚刚这样做了:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
mainbarController = [[MainBarController alloc]initWithNibName:@"MainBarController" bundle:nil];
[self.window setRootViewController:mainbarController];
[self.window makeKeyAndVisible];
return YES;
}

我的问题是,我想将tabBar放在其他地方,而不是底部,就像我运行项目时一样。但我找不到我的代码的xib文件。 mainwindow.xib只是一个空窗口。我知道这是非常基本的,但我对此感到困惑。

非常感谢

0 个答案:

没有答案