Re: NSTextView append Text help
Re: NSTextView append Text help
- Subject: Re: NSTextView append Text help
- From: WT <email@hidden>
- Date: Thu, 30 Apr 2009 20:40:27 +0200
If you look at the documentation for UITextView,
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITextView_Class/UITextView_Class.pdf
you'll notice that UITextView instances do not know how to respond to
the -string or -replaceCharactersInRange:withString: messages.
Instead, they have a property
text
The text displayed by the text view.
@property(nonatomic, copy) NSString *text
which means that you can retrieve the instance's text by doing
something like
NSString* currentText = txvMain.text;
and also set it by doing
txvMain.text = someString;
And those two are the only things you can do in regards to the text
view's text. Thus, you should first retrieve the current text from the
text view, then do all your string manipulation using NSString
methods, and then set the text view's text to the final result.
Also, in the future, when you come across a problem that you don't
know how to fix, please try to read the documentation first. It's
freely available, it's well written (for the most part), and it's
there for a reason.
Hope this helps.
Wagner
On Apr 30, 2009, at 7:37 AM, Chad Eckles wrote:
Hello I'm very new to iphone dev and am having some issues with
appending
text from my NSTextView the
the NSTextView name is txvMain
code I have is
[txvMain replaceCharactersInRange:NSMakeRange([[txvMain
string]length],0)
withString:@"Hello"]];
and the errors I'm getting are
Warning: "UITextView" may not respond to '-string'
(Message without a matching method signature will be assumed to
return "id"
and accept "..." as arguments.)
Warning:"UITextView" may not respond to
'-replaceCharactersInRange:withString'
error: syntax error before"]" token
BTW: code came straight from my book.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden