TwoViewController.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // TwoViewController.swift
  3. // OJASwiftKitDemo
  4. //
  5. // Created by luxiaoming on 2017/3/7.
  6. // Copyright © 2017年 luxiaoming. All rights reserved.
  7. //
  8. import UIKit
  9. class TwoViewController: UIViewController {
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. self.view.backgroundColor = UIColor.blue
  13. // Do any additional setup after loading the view.
  14. NSLog("it is \(self)")
  15. let testButton = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
  16. testButton.backgroundColor = UIColor.gray
  17. self.view.addSubview(testButton)
  18. testButton.addCallback { [weak self] (sender) in
  19. NSLog("it is \(String(describing: self?.presentingViewController))")
  20. if let strongSelf = self {
  21. strongSelf.title = "two"
  22. let threeViewController = ThreeViewController()
  23. strongSelf.present(threeViewController, animated: true, completion: {
  24. })
  25. }
  26. }
  27. }
  28. override func didReceiveMemoryWarning() {
  29. super.didReceiveMemoryWarning()
  30. // Dispose of any resources that can be recreated.
  31. }
  32. /*
  33. // MARK: - Navigation
  34. // In a storyboard-based application, you will often want to do a little preparation before navigation
  35. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  36. // Get the new view controller using segue.destinationViewController.
  37. // Pass the selected object to the new view controller.
  38. }
  39. */
  40. }