Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FooTwoViewController.swift
- // Swift2DelegateFoo
- //
- // Created by Steven Lipton on 6/29/14.
- // Copyright (c) 2014 Steven Lipton. All rights reserved.
- // updated 9/17/15 SJL for Swift 2.0
- import UIKit
- protocol FooTwoViewControllerDelegate{
- func myVCDidFinish(controller:FooTwoViewController,text:String)
- }
- class FooTwoViewController: UIViewController {
- var delegate:FooTwoViewControllerDelegate? = nil
- var colorString:String = ""
- @IBOutlet var colorLabel : UILabel!
- @IBAction func saveColor(sender : UIBarButtonItem) {
- if (delegate != nil) {
- delegate!.myVCDidFinish(self, text: colorLabel!.text!)
- }
- }
- @IBAction func colorSelectionButton(sender: UIButton) {
- colorLabel.text = sender.titleLabel!.text!
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- colorLabel.text = colorString
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement