cocos2dbeginner
cocos2dbeginner

Reputation: 2217

How to get the string value of a UItextView?

I have a UITextView and a NString;

I made this:

myS = [myInfoTextView text];

but i get this in the console and not the string which is in the uitextview

 (
    "<UIToolbarTextButton: 0x4d200c0; frame = (6 0; 112 44); opaque = NO; layer = <CALayer: 0x4da5540>>",
    "<UIToolbarTextButton: 0x4da5bb0; frame = (128 0; 106 44); opaque = NO; layer = <CALayer: 0x4d9e640>>"
) 

PS: I'm using the iphone sdk 4.2.

Upvotes: 0

Views: 6607

Answers (2)

Sabby
Sabby

Reputation: 2592

That is the specification of the ToolBar Button.You are not getting the value of Text view in string and moreover you are not priting it with NSLog.You get the text in the console by printing it with NSLog. Do it the way as Snehal is saying.

NSString *textValue = [NSString stringWithFormat:@"%@", myTextView.text];
NSLog(@"Text Value is %@", textValue);

Hope you will get to the desired output.

Upvotes: 0

Snehal
Snehal

Reputation: 597

Instead of the above code, try this

NSString *textValue = [NString stringWithFormat:@"%@", myTextView.text];
NSLog(@"%@", textValue);

Upvotes: 3

Related Questions