I am using a UITextView and have the UITextViewDelegate attached to the View Controller. When the user clicks on the TextView I have a "placeholder" label over the text view that I want to hide/un-hide depending on whether the user has any text in the text view. However, there seems to be an issue with executing UI operations in the UITextViewDelegate textViewDidBeginEditing and textViewDidEndEditing methods. In unit tests everything runs fine, but when running the app the UI doesn't update. I even tried wrapping the UI in a dispatch_async block to force the UI thread, but it seems slow and fickle (sometimes it works and sometimes it doesn't). Had anyone else seen this? Am I missing something that is blatantly right in front of me?
public func textViewDidBeginEditing(textView: UITextView) {
switch(textView) {
case self.descriptionTextView:
self.activeTextView = self.descriptionTextView
break
case self.detailTextView:
self.activeTextView = self.detailTextView
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.detailsRequiredButton!.hidden = true
})
break
default:
break
}
}