import UIKit class ViewController: UIViewController { override func viewDidLoad(){ super.viewDidLoad() } @IBAction func experiment(){ let image = UIImage() let controller = UIActivityViewController(activityItems: [image], applicationActivities: nil) self.presentViewController(controller, animated: true, completion:nil) } }
@IBAction func experiment(_ sender: Any){ let nextController = UIImagePickerController() self.present(nextController, animated: true, completion: nil) } @IBAction func experiment(_ sender: Any){ let image = UIImage() let controller = UIActivityViewController(activityItems: [image], self.present(controller, animated: true, completation: nil)) }
import UIKit class DiceViewController: UIViewController { var firstValue: Int? var secondValue: Int? @IBOutlet var firstDie: UIImageView! @IBOutlet var secondDie: UIImageView! override func viewWillAppear(animated: Bool){ if let firstValue = self.firstValue { self.firstDie.image = UIImage(named: "d\(firstValue)") } else { self.firstDie.image = nil; } if let secondValue = self.secondValue { self.secondDie.image = UIImage(named: "d\(secondValue)") } else { self.secondDie.image = nil } self.firstDie.alpha = 0 self.secondDie.alpha = 0 } }