导入UIKit // MARK:属性 class ViewController:UIViewController,UITextFieldDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate
{
@IBOutlet weak var nameTextField:UITextField!;
@IBOutlet weak var mealNameLabel: UILabel!
@IBOutlet weak var photoImageView: UIStackView!
@IBAction func setDefaultLabelText(sender: UIButton)
{
mealNameLabel.text = "Default Text"
}
override func viewDidLoad()
{
super.viewDidLoad()
//self = viewController
nameTextField.delegate = self
}
//UItextFieldDelegate
func textFieldShouldReturn(textField: UITextField) -> Bool
{
//keyboard goes when done
textField.resignFirstResponder()
return true
}
func imagePickController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
self.photoImageView.image = selectedImage
dismissViewControllerAnimated(true, completion: nil)
}
我正在研究Xcode的教程,并且遇到了上面列出的问题。任何帮助,将不胜感激。谢谢!
答案 0 :(得分:0)
那么photoImageView不应该是UIImageView吗?
@IBOutlet weak var photoImageView: UIImageView!