31117

How to get the string value of a UItextView?

Question:

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.

Answer1:

Instead of the above code, try this

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

Answer2:

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.

Recommend

  • CALayer not rendering when added after view visible
  • Simple example of CALayer usage — perhaps in a UITextField
  • UIPanGestureRecognizer - move view instantly
  • Core animation stops when the Master of the split viewcontroller hide (in portrait mode)?
  • Solid Shadow in All Directions
  • general concept-java code and cycle clocks
  • eC (Ecere) how to not worry about private data fields of a class
  • Recreate Apple Watch fitness tracker ‘progress’ bar - gradient on CAShapeLayer stroke
  • Drag and reorder - UICollectionview with sections
  • Thrust filter by key value
  • Accessing Windows Azure Queues from client side javascript/jquery
  • How to enable large page memory for the JVM?
  • vectorized indexing/slicing in numpy/scipy?
  • Stop Bash Script if Hive Fails
  • R - Combining Columns to String Based on Logical Match
  • How to show dropdown in excel using jrxml (jasper api)?
  • Importing jscolor library in angular 2
  • Release, debug version and Authorization Google?
  • jquery mobile loadPage not working
  • Apache 2.4 - remove | delete | uninstall
  • How to delete a row from a dynamic generate table using jquery?
  • Python: how to group similar lists together in a list of lists?
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Free memory of cv::Mat loaded using FileStorage API
  • Trying to get generic when generic is not available
  • Getting Messege Twice Using IMvxMessenger
  • embed rChart in Markdown
  • Change div Background jquery
  • How to get Windows thread pool to call class member function?
  • Bitwise OR returns boolean when one of operands is nil
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?