When I type in something in, the text of the textview appears. When I repeat that the text CHANGES. But I want to add a line. Could somebody please tell me how to do that?
When I type in something in, the text of the textview appears. When I repeat that the text CHANGES. But I want to add a line. Could somebody please tell me how to do that?
vincefried
Several things:
In one part of your code you call it mTextField, and in another part you call t mTextView. Do you have two different text objects?
Are you using UITextView or UITextField objects? A UITextView is a multi-line, scrollable text object.
If you are creating UITextFields, though, I don't think they are set up to display multiple lines of text.
If you're using a UILabel (read-only) they default to a single line, but can be set up to display multiple lines. To do that set the numberOfLines property to 0.
Next, assuming you're using a UITextView, you will need to append new text to the end of the old. To get the new text to begin on a new line, you'll need to add a carriage return at the end of the old text. Something like this:
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
... I didn't describe it right... first you connect over peer-to-peer to another device. Then, you have a textfield and a textview. in the textfield, you type in something, and then it displays the typed text in the textview of your peer. the textview is not editable. there's a "send"-button, which is connected to the sendData-action. everytime, I press the send button, the text in the textview of my peer will be replaced by the new text, I typed in, but it should be added in a new line, just like a messenger. I hope that helped
... I didn't describe it right... first you connect over peer-to-peer to another device. Then, you have a textfield and a textview. in the textfield, you type in something, and then it displays the typed text in the textview of your peer. the textview is not editable. there's a "send"-button, which is connected to the sendData-action. everytime, I press the send button, the text in the textview of my peer will be replaced by the new text, I typed in, but it should be added in a new line, just like a messenger. I hope that helped
Ok, so take the contents of your text field and/or the response from the server and append it to the contents of the text view as I outlined in my post.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.