I currently have the following code:
class NewPostController: UIViewController {
@IBOutlet weak var MessageField: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
MessageField.text = "What's on your mind?"
MessageField.textColor = UIColor.lightGrayColor()
}
func textViewDidBeginEditing(MessageField: UITextView) {
if MessageField.textColor == UIColor.lightGrayColor() {
MessageField.text = ""
MessageField.textColor = UIColor.blackColor()
}
}
However, whenever I edit MessageField
, the code within textViewDidBeginEditing
doesn't run. I suspect this is because of an invalid way of referencing MessageField
within the function, but I don't know what to do.