2016-11-09 76 views
-2

我直接執行this tutorial直到分鐘8:35,它不起作用。SWRevealViewController不工作

import Foundation 
    class ViewController: UIViewController { 
@IBOutlet weak var Open: UIBarButtonItem! 
override func viewDidLoad() { 
    super.viewDidLoad() 
    print("open") 
    Open.target = self.revealViewController() 
    Open.action = Selector("revealToggle:") 
    print("open2") 
} 
override func viewDidAppear(_ animated: Bool) { 
} 
override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
}} 

但是,它的值得注意。我得到這個頁面閃屏page.And以下後我怎麼做

let storyboard = UIStoryboard(name: "Main", bundle: nil)         
    let vc = storyboard.instantiateViewController(withIdentifier: "Navigate") as! UINavigationController        
         //self.present(vc, animated: true, completion: nil) 
         let appDelegate = UIApplication.shared.delegate as! AppDelegate 
         appDelegate.window?.rootViewController = vc 

從Splashscontroller我打電話去main.storyboard。 導航,我點擊導航控制器,並給它storyboardid導航。

我打開頁面,打開按鈕..但沒有權利揭示控制器打開時,我點擊它。

+0

我試圖instantiateViewController(withidentifier:「SWRevealViewController」越來越黑屏 –

回答

0

請編輯您的appdelegate「didFinishLaunchingWithOptions」方法的代碼如下

//創建的viewController代碼...

let storyboard = UIStoryboard(name: "Main", bundle: nil) 

let mainViewController = storyboard.instantiateViewControllerWithIdentifier(""Navigate") as! UINavigationController 

let leftViewController = storyboard.instantiateViewControllerWithIdentifier("Left") as! LeftSideMenuViewController 

let slideMenuController = SlideMenuController(SailDataViewController:mainViewController , LeftSideMenuViewController : leftViewController) 

    self.window?.rootViewController = slideMenuController 
    self.window?.makeKeyAndVisible() 

UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true) 

請檢查您的類名,因爲我還沒有運行該代碼。但在我的項目中,它正在工作。

+0

不工作,也正在使用最新的迅速 –

+0

它是在swift2.3,請爲SWIFT 3 – Harish

+0

SlideMenuController一些改動不存在,在。庫 –

相關問題