开发者

iOS Text View Not Updating

I've got a UITextView defined by

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

in my view c开发者_Go百科ontroller header, and I can set the value by using

quote.text = @"some text";

but the view doens't want to update the value, what can I do


Setting the text should immediately cause the UITextView to render your text under normal conditions.

Are you sure your that:

  1. The UITextView is placed appropriately in your Nib and is visible?
  2. The UITextView is appropriately linked with your outlet in your file owner (aka view controller)?

A quick test to verify the visibility of your UITextView - just place some sample text in it in the nib and verify that it appears on launch. If so, then you know that at least your view is displaying appropriately. At that point, it would have to be related to #2.


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


I just bumped into this too and the problem went away as soon as I specified enough height for the content. In Xcode it may still look all right, but AutoLayout decided to do without the TextView if there was no height-constraint on it.

This was probably not your problem back when you asked the question, but it still turned up fairly early in my google search, therefore I post this answer anyway.

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

This just to show us how difficult it is to get user interfaces right all the time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜