AppDelegate의 didFinishLaunching 메소드에서 뷰 컨트롤러를 만들고이를 윈도우의 루트보기 컨트롤러에 지정했습니다.스토리 보드를로드 할 때 오리엔테이션 문제 -
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds) // issue with allocating UIWindow
self.viewController = AKSidePanelController()
self.viewController!.centerPanel = UINavigationController(rootViewController: UIStoryboard.centerViewController()!)
window!.rootViewController = self.viewController
window!.makeKeyAndVisible()
return true
}
func shouldAutorotate() -> Bool {
return true
}
func supportedInterfaceOrientations() -> Int {
return UIInterfaceOrientation.Portrait.rawValue | UIInterfaceOrientation.LandscapeLeft.rawValue | UIInterfaceOrientation.LandscapeRight.rawValue
}
자동 회전이 작동하지 않습니다. 나는 문제가 didfinishlaunching에서 창을 할당하기 때문에라고 생각한다. didFinishLaunching에 코드를 추가하지 않고서도 (isInitialViewController = yes라고 표시하여) 스토리 보드에서 직접 실행하려고하면 자동 회전이 작동합니다. 당신이 볼 수 있듯이, 나는 "viewController"를 rootviewcontroller로로드 할 필요가있다. 내가 뭘 잘못하고있어? 내가 엑스 코드 6.1