Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawer like Google material design for iOS

I'd like to implement navigation drawer like Uber into iOS(swift). I'm going to achieve it by using a library, called KYDrawerController. https://github.com/ykyouhei/KYDrawerController

However, it cannot provide toggle button, only slide action. Thought I'd like to to implement toggle button that shows the navigation drawer,I have no idea how to add such a function to the library. If you know how to add the function to the library, or how to achieve my purpose the other way(such as to use the other libraries), please tell me. Thank you for your kindness.

Uber1 Uber2

like image 704
Toshi Avatar asked Aug 10 '15 23:08

Toshi


1 Answers

Using KYDrawerController it can be implemented as follows:

class MainViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        view.backgroundColor = UIColor.whiteColor()
        title = "MainViewController"
        navigationItem.leftBarButtonItem = UIBarButtonItem(
            title: "Open",
            style: UIBarButtonItemStyle.Plain,
            target: self,
            action: "didTapOpenButton:"
        )
    }

    func didTapOpenButton(sender: UIBarButtonItem) {
        if let drawerController = navigationController?.parentViewController as? KYDrawerController {
            drawerController.setDrawerState(.Opened, animated: true)
        }
    }
}

https://github.com/ykyouhei/KYDrawerController/tree/master/Example/Code

like image 167
Kyouhei Yamaguchi Avatar answered Oct 24 '22 00:10

Kyouhei Yamaguchi