在swift中的一个选项中隐藏ECSlidingViewController中的菜单栏

时间:2015-09-03 04:16:43

标签: swift ecslidingviewcontroller ecslidingviewcontroller-2

我正在使用ECSlidingViewController进行菜单导航。我有一个选项注销,在选择注销时用户。当用户登录agin时,菜单栏将显示而不是隐藏。在退出选择时隐藏菜单栏的Swift代码。

import Foundation
import UIKit
import Parse

class MenuTableViewController: UITableViewController {
@IBAction func unwindToMenuViewController(segue: UIStoryboardSegue) {
}
override func viewDidLoad() {
    super.viewDidLoad()
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}
override func tableView(tableView: UITableView,   didSelectRowAtIndexPath indexPath: NSIndexPath) {
    if indexPath.row == 4 {
        PFUser.logOut()

        var loadLoginPage: UINavigationController = self.storyboard?.instantiateViewControllerWithIdentifier("LoginNavigationController")! as UINavigationController
        self.presentViewController(loadLoginPage, animated: false, completion: nil)
    }
}
}

2 个答案:

答案 0 :(得分:0)

试试self.slidingViewController?.resetTopViewAnimated(true)。然后,只需从当前顶视图中删除ECSlidingViewController的平移手势识别器,并禁用可能打开菜单的任何按钮。

答案 1 :(得分:0)

var slidingViewController: ECSlidingViewController = self.view.window?.rootViewController as! ECSlidingViewController  
slidingViewController.resetTopViewAnimated(true)