1
我想通過此UI圖像視圖從一個視圖控制器到另一個在同一個故事板上。我已經將UI TextField傳遞給了UI標籤和UI按鈕。現在我需要使用UI圖像視圖來完成它。如何將UI ImageView從一個視圖控制器傳遞到另一個視圖控制器? swift 3
這是我的兩個視圖控制器。
import UIKit
class PhotoShareViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var contentTextView: UITextView!
@IBOutlet weak var thatTextField: UITextField!
@IBOutlet weak var thisTextField: UITextField!
var presenter: PhotoShareModuleInterface!
var image: UIImage!
@IBAction func thisUploadPhoto(_ sender: Any) {
if thisTextField.text != "" && thatTextField.text != ""
{
performSegue(withIdentifier: "segue", sender: nil)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
var photoShareLabelViewController = segue.destination as! PhotoShareLabelViewController
photoShareLabelViewController.thisString = thisTextField.text!
photoShareLabelViewController.thatString = thatTextField.text!
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
imageView.image = image
}
override var prefersStatusBarHidden: Bool {
return true
}
@IBAction func didTapCancel(_ sender: AnyObject) {
presenter.cancel()
presenter.pop()
}
/* @IBAction func didTapDone(_ sender: AnyObject) {
guard let message = thatTextField.text, !message.isEmpty else {
return
}
guard let messageOne = thisTextField.text, !messageOne.isEmpty else {
return
}
presenter.finish(with: image, content:message)
presenter.dismiss()
}
}
*/
}
extension PhotoShareViewController: PhotoShareViewInterface {
var controller: UIViewController? {
return self
}
}
如果有人可以告訴我如何將圖像從一個視圖控制器發送到另一個會很棒!
通過傳遞「我已經將UI TextField傳遞給UI標籤和UI按鈕」意味着什麼。 – Alan