2016-05-24 1 views
0

私は次のコードでこれを実行しようとしました。ただし、動作しません。(即時)初期表示コントローラ呼び出しテーブルビューコントローラなしボタンなし

警告:ウィンドウの階層に表示されていないビューを表示しようとしました!

ボタンを押すことなく他のView Controllerを呼び出す方法はありますか?

override func viewDidLoad() { 
    super.viewDidLoad() 
    // Do any additional setup after loading the view, typically from a nib. 

    let configuration = WKWebViewConfiguration() 
    let controller = WKUserContentController() 
    controller.addScriptMessageHandler(self, name: "JSListener") 
    configuration.userContentController = controller 

    let webview = WKWebView(frame: self.view.frame, configuration: configuration) 
    let url = NSBundle.mainBundle().URLForResource("index1", withExtension: "html") 
    let request = NSURLRequest(URL: url!) 

    self.view = webview 
    webview.loadRequest(request) 

    let secondViewController:UIViewController = OurTableViewController() 
    self.presentViewController(secondViewController, animated: true, completion: nil) 
} 

答えて

0

はその

override func viewDidAppear(animated: Bool) { 
    let secondViewController:UIViewController = OurTableViewController() 
    self.presentViewController(secondViewController, animated: true, completion: nil) 
} 
+0

ようviewDidAppearにいくつかのエラースローを

let secondViewController:UIViewController = OurTableViewController() self.presentViewController(secondViewController, animated: true, completion: nil) 

を動かすようにしてください。 ableViewチュートリアル[12959:283655] ***アサーションエラー - [UITableView dequeueReusableCellWithIdentifier:forIndexPath:]、/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:2016-05-24 11:14:53.402 TableViewチュートリアル[12959:283655] ***キャッチされていない例外 'NSInternalInconsistencyException'のためにアプリケーションを終了しています、理由: '識別子でセルをデキューできませんourCell - ペンまたはクラスを登録する必要がありますストーリーボードのプロトタイプセルを識別子に接続するか、 –

関連する問題