开发者

How to get the string value of a UItextView?

开发者 https://www.devze.com 2023-02-02 08:19 出处:网络
I have a UITextView and a NString; I made this: myS = [myInfoTextView text]; but i get this in the con开发者_如何学编程sole and not the string which is in the uitextview

I have a UITextView and a NString;

I made this:

myS = [myInfoTextView text];

but i get this in the con开发者_如何学编程sole 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.


Instead of the above code, try this

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


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.

0

精彩评论

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

关注公众号