在scrollView或pageViewController中addChildViewController后, 在AViewController中使用下面代碼時,程序運行會奔潰
let VC = storyboard?.instantiateViewControllerWithIdentifier("B") as! BViewController
原因是在代碼創建的AViewController跳轉到storyBoard關聯的BViewController識別不了, 具體原因我還不知道
解決辦法有兩個:
1 : A和B 里面的控件都用純代碼創建, 不用storyboard
2:在storyboard中創建一個視圖控制器, 再關聯A, 同時, 之前寫的
let aVC = AViewController()
改成
let aVC = storyboard?.instantiateViewControllerWithIdentifier("A") as! AViewController