I've got two textviews on my view and I want them both to be editable.
But each one pertains to a different record in my database.
How would I be able to detect which textView is being edited?
Here is my code so far
func textViewDidChange(textView: UITextView) { //Handle the text changes here
if(textView.textAlignment == .Center){
PFUser.currentUser()!["bio"] = textView.text
PFUser.currentUser()!.saveInBackground()
}
else{
PFUser.currentUser()!["displayName"] = textView.text
PFUser.currentUser()!.saveInBackground()
}
}
What I'm currently doing is detecting if the view is right aligned or center aligned to be able to tell them apart. This works but it's not ideal as I'd like to have both of them center aligned. But I'm unaware which field in the textView object would contain an ID or some method of identification as to which textView the function was called for.
tags
totextView
and check it in yourdelegate
astextView.tag
.textView == textViewOne
if you madetextViewOne
asiboutlet
isnt it....Its only hard if you dont have reference to it