IOS text view not updated

I have a UITextView defined by

@property (nonatomic, retain) IBOutlet UITextView *quote; 

in my view, the controller header, and I can set the value using

 quote.text = @"some text"; 

but the view does not want to update the value, what can I do

+4
source share
3 answers

The text setting should immediately force the UITextView to display text under normal conditions.

Are you sure this is:

  • Is a UITextView placed appropriately in your Nib and displayed?
  • Is the UITextView appropriately connected to your outlet with the file owner (aka view controller)?

A quick test to check the visibility of your UITextView is to simply put an example of text in it and make sure it appears at startup. If so, then you know that at least your view is displayed accordingly. At this point, this should be due to No. 2.

+3
source

Make sure you connect quote to your UITextField in your XIB. Also, make sure you @synthesize quote; in .m .

+2
source

I just ran into this and the problem disappeared as soon as I determined enough height for the content. In Xcode, it might still look fine, but AutoLayout decided to dispense with the TextView if it didn't have a height limit.

It was probably not your problem when you asked this question, but it still appeared quite early in my Google search, so I am posting this answer anyway.

Btw: Xcode is still a bit valid when you edit the constraint. It will update the view (and save) if you press 'Enter' in the Constant-Field, but it will not do it if it loses focus in some other way.

This is just to show us how difficult it is to constantly access user interfaces.

0
source

Source: https://habr.com/ru/post/891688/


All Articles