// // TwoViewController.swift // OJASwiftKitDemo // // Created by luxiaoming on 2017/3/7. // Copyright © 2017年 luxiaoming. All rights reserved. // import UIKit class TwoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.blue // Do any additional setup after loading the view. NSLog("it is \(self)") let testButton = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) testButton.backgroundColor = UIColor.gray self.view.addSubview(testButton) testButton.addCallback { [weak self] (sender) in NSLog("it is \(String(describing: self?.presentingViewController))") if let strongSelf = self { strongSelf.title = "two" let threeViewController = ThreeViewController() strongSelf.present(threeViewController, animated: true, completion: { }) } } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }