Drawer like Google material design for iOS

前端 未结 1 1811
一整个雨季
一整个雨季 2021-02-04 12:37

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/KYDrawerC

相关标签:
1条回答
  • 2021-02-04 13:14

    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

    0 讨论(0)
提交回复
热议问题