Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // FooTwoViewController.swift
  2. // Swift2DelegateFoo
  3. //
  4. // Created by Steven Lipton on 6/29/14.
  5. // Copyright (c) 2014 Steven Lipton. All rights reserved.
  6. // updated 9/17/15 SJL for Swift 2.0
  7.  
  8. import UIKit
  9.  
  10. protocol FooTwoViewControllerDelegate{
  11. func myVCDidFinish(controller:FooTwoViewController,text:String)
  12. }
  13.  
  14. class FooTwoViewController: UIViewController {
  15. var delegate:FooTwoViewControllerDelegate? = nil
  16. var colorString:String = ""
  17. @IBOutlet var colorLabel : UILabel!
  18.  
  19. @IBAction func saveColor(sender : UIBarButtonItem) {
  20. if (delegate != nil) {
  21. delegate!.myVCDidFinish(self, text: colorLabel!.text!)
  22. }
  23. }
  24.  
  25. @IBAction func colorSelectionButton(sender: UIButton) {
  26. colorLabel.text = sender.titleLabel!.text!
  27. }
  28.  
  29. override func viewDidLoad() {
  30. super.viewDidLoad()
  31. // Do any additional setup after loading the view.
  32. colorLabel.text = colorString
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement