CodeGuy
CodeGuy

Reputation: 28907

Changing the text in a UITextView at runtime

I have a ViewController consisting of just a textView. In its viewDidLoad method, I simply initialize the textView and add it as a subview. In my main ViewController class, when the user presses a button, I switch views and display the view that has the textView. I am trying to change the textView's text however it is not working. Can I not change the text of a UITextView at runtime?

Thanks.

Upvotes: 0

Views: 315

Answers (1)

Michael Kessler
Michael Kessler

Reputation: 14235

You should keep a reference to your text view.

If you do, then make sure that the reference is correct and valid before setting the new text.

In general, it always helps when you post a problematic code - this way it is much easier for us to help you...

Upvotes: 0

Related Questions