とりあえずこんな感じに クラスを作った
class NKTabBarController : UITabBarController{
override func viewDidLoad() {
super.viewDidLoad();
var first = self.storyboard?
.instantiateViewControllerWithIdentifier("NKFirstView") as! UIViewController;
var second = self.storyboard?
.instantiateViewControllerWithIdentifier("NKSecondView") as! UIViewController;
self.tabBarController?.setViewControllers([first, second], animated: true);
}
}
正解
class NKTabBarController : UITabBarController{
override func viewDidLoad() {
super.viewDidLoad();
var first = self.storyboard?
.instantiateViewControllerWithIdentifier("NKFirstView") as! UIViewController;
var second = self.storyboard?
.instantiateViewControllerWithIdentifier("NKSecondView") as! UIViewController;
//self.tabBarController?.setViewControllers([first, second], animated: true);
self.setViewControllers([first, second], animated: true);
}
}
UITabBarController を直接親クラスとして継承してるから、自分の setViewControllersを呼べばよかったのね
たぶんUINavigationController の方も同じやな…
ではでは


