【问题标题】:How to use reveal view controller in the middle of the project rather than initial view controller如何在项目中间使用显示视图控制器而不是初始视图控制器
【发布时间】:2016-04-18 05:41:25
【问题描述】:

我正在快速使用revealviewcontroller。成功登录后,我的控件应该会显示视图控制器。但是当我移动显示视图控制器时,我的菜单栏按钮不起作用。

let svc :SWRevealViewController = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController

let navigationController = UINavigationController(rootViewController: svc)

self.presentViewController(navigationController, animated: true, completion: nil)

【问题讨论】:

标签: ios swift


【解决方案1】:

在应用委托中

 let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate { 
 .....
 }

 fun rootVC()
 {
  let svc :SWRevealViewController = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController
  let navigationController = UINavigationController(rootViewController: svc)
  self.presentViewController(navigationController, animated: true, completion: nil)
 }

Set Initialise VC is LoginVC... 登录后输入 Secure PIN... On Click On Submit Call rootVC 如下

func SubmitAction(sender : UIButton)
{
 appDelegate.rootVC()
}

不需要在任何视图控制器中创建应用委托对象...

希望你能理解..

谢谢

【讨论】:

  • 感谢两位。 @karthick。单击提交按钮后,我可以导航到帐户视图。但是菜单按钮仍然不起作用.... if self.revealViewController() != nil { menuIcon.target = self.revealViewController() menuIcon.action = "revealToggle:" menuIcon.action = Selector("revealToggle:") self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer()) }
  • 终于找到了解决方案,将显示视图控制器作为根视图控制器并在应用程序委托中声明它并在提交点击操作时调用它。感谢大家的快速回复。
  • 你好兄弟@MemonIrshad,你能帮我检查一下我的问题stackoverflow.com/questions/42573338/…吗??
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-17
  • 1970-01-01
相关资源
最近更新 更多