我正在尝试使用位于https://github.com/goktugyil/EZSwiftExtensions的Swift扩展程序。自述文件状态
1.下载' /来源'在你的项目中。
2.Congratulations!
我已经按照我的理解遵循了这些说明,并将Sources文件夹放入了我的项目中:
但是,当我尝试使用其中一个扩展名 self.hideKeyboardWhenTappedAround()时,我收到错误"类型值' LoginVC'没有会员&hide.ceyboardWhenTappedAround'"。我对Swift非常陌生,所以我真的不确定我在这个问题出在哪里
我的代码副本:
import UIKit
class LoginVC: UIViewController, UITextFieldDelegate {
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var passwordField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
self.hideKeyboardWhenTappedAround(); // <--- Error produced here!
// Do any additional setup after loading the view.
self.emailField.delegate = self;
self.passwordField.delegate = self;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}