我只是实施this tutorial直到8:35分钟,但它没有用。
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.
}}
然而,值得注意。我在启动画面页面后进入此页面。下面是如何做到的
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 :(得分: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)
请检查您的班级名称,因为我还没有运行此代码。但在我的项目中,它正在发挥作用。