Added automatic copying of data to clipboard

This commit is contained in:
Alexander Munch-hansen 2017-08-01 14:39:45 +02:00
parent b56924322c
commit 548b560582

View File

@ -17,6 +17,7 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP
var responseString : String! var responseString : String!
@IBOutlet weak var uploadProgressBar: UIProgressView! @IBOutlet weak var uploadProgressBar: UIProgressView!
@IBOutlet weak var savedPhotoImageView: UIImageView! @IBOutlet weak var savedPhotoImageView: UIImageView!
let pasteBoard = UIPasteboard.general
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -46,6 +47,7 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
imagePickerController.dismiss(animated: true, completion: nil) imagePickerController.dismiss(animated: true, completion: nil)
imageView.contentMode = .scaleAspectFit
imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
} }
@ -83,9 +85,9 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP
print("responseString = \(String(describing: self.responseString))") print("responseString = \(String(describing: self.responseString))")
DispatchQueue.main.async() { DispatchQueue.main.async() {
self.setTextInField(path: "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))") self.setTextInField(path: "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))")
self.pasteBoard.string = self.dcavTextField.text!
} }
} }
task.resume() task.resume()
} }