// // OneViewController.swift // OJASwiftKitDemo // // Created by luxiaoming on 2016/12/5. // Copyright © 2016年 luxiaoming. All rights reserved. // import UIKit import OJASwiftKit class OneViewController: OJSViewController { var testButton: UIButton! init(shouldHideNavigationBar: Bool = true) { super.init(nibName: nil, bundle: nil) ojs_shouldHideNavigationBar = shouldHideNavigationBar ojs_shouldHideCustomNavBar = false } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } deinit { DLog("deinit") } } // MARK: - Lifecycle extension OneViewController { override func viewDidLoad() { super.viewDidLoad() self.title = "hello" self.view.backgroundColor = UIColor.orange // setupDefalutBackNavBarView() setupDefalutBackDismissBarView() DLog("hello") let testButton = UIButton(frame: CGRect(x: 0, y: 100, width: 100, height: 100)) testButton.backgroundColor = UIColor.gray self.view.addSubview(testButton) testButton.addCallback { [unowned self] (sender) in Delay(3, closure: { self.setupDefalutBackNavBarView() }) // let twoViewController = TwoViewController() // self.present(twoViewController, animated: true, completion: { // // }) } self.testButton = testButton } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } // MARK: - PublicMethod extension OneViewController { func setupDefalutBackNavBarView() { self.ojs_navBarView?.backgroundColor = UIColor.blue self.ojs_navBarView?.viewType = .type1_0 let image = UIImage(named: "nav_back") self.ojs_navBarView?.leftOneButton.setImage(image, for: .normal) self.ojs_navBarView?.leftOneButton.addCallback { [unowned self] (sender) in let _ = self.navigationController?.popViewController(animated: true) } } func setupDefalutBackDismissBarView() { self.ojs_navBarView?.viewType = .type0_1 self.ojs_navBarView?.rightOneButton.setImage(UIImage(named: "nav_close"), for: .normal) self.ojs_navBarView?.rightOneButton.addCallback { [unowned self] (sender) in self.dismiss(animated: true, completion: nil) } } }