2014年3月20日 星期四

手動以array設定 tab bar view controller

//先new幾個view controller
//...

self.tabBarController = [UITabBarController new];
    self.tabBarController.delegate = self;

//再把它們以Array的形式傳入tab bar controller
self.tabBarController.viewControllers = [NSArray arrayWithObjects:storeTab, mapTab, chatTab, aboutTab, nil];

//把tab bar controller設為rootViewController
    self.window.rootViewController = self.tabBarController;
    self.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self.window makeKeyAndVisible];

沒有留言:

張貼留言