Unable to add space at end of UITextView

I have a UITextView in which I want the initial value to be "@username" when the keyboard appears (note the space after the username). Thus, the user can immediately type text without pressing the spacebar. So I:

textView.text = [NSString stringWithFormat:@"@%@ ", username];

But it seems impossible for the property to UITextView textend with a space (it is always deleted). I'm right? Is there a workaround for this?

I tried using \schar and did not succeed.

EDIT : see first answer below. The error was sent by Apple. - # 8038616

+3
source share
3 answers

, Google (.. http://www.iphonedevsdk.com/forum/iphone-sdk-development/44039-uitextview-whitespace-cursor-position.html), , UITextView, setter text. .

: , UITextView . text, , Twitterific. , , , UITextView , - , ( , ).

+2

NSString , . , - .

0

NSLog :

NSLog(@"@%@ ", @"test");

As long as the space is not displayed directly, it can be made visible by selecting text in the console.

Your problem is probably elsewhere.

-2
source

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


All Articles