views:

47

answers:

2

How can I initialize a UITextView that is nice and pretty. I have the line:

textView = [[UITextView alloc] initWithFrame:CGRectMake(150, 150, 100, 100)];

but I'd like to make it look nice and I do not know the functions or the syntax to do so. I'd like it to have word wraping and I'd like the corners to be rounded. Also, how can I make it so that the keyboard goes away if the user presses "Return" on the keyboard. And I'd like to make it say "Done" instead of "Return"

Thanks!

A: 

check out the UItextInputTraits protocol that is linked from the UITextView documentation. All of these properties can be found there, and others.

EX:

textView.returnKeyType = UIReturnKeyTypeDone;
Jesse Naugher
A: 

You should check the documentation. This is all in there. Specifically:

  • you can't set the border, you can only do that for a UITextField
  • you'll need to set your delegate and implement -textViewDidChange: to check for returns
  • you can set textView.returnKeyType to UIReturnKeyDone to get the Done button.

You might want to consider using a UITextField, as that object's delegate has a very convenient -textFieldShouldReturn: method, and you can, as I said, set its border.

Ben Gottlieb