1

How do I make a UITextView behave like a UITextField or maybe how to make a UITextField appear like this, same with the photo, i've searched a lot about making UITextField into multiple lines but i can't seem to get how they did it, is there any method that is much simpler,

enter image description here

I also tried putting a UITextView and then sending it at back and putting at top a UITextField and in the viewDidLoad I did self.commentTextField.frame = self.commentsTextView.frame; , i thought it would make the UITextField like a UITextView. I want that when I start editing this - (void)textFieldDidBeginEditing:(UITextView *)textField; delegate would detect that Im editing the UITextField because I can't seem to detect when Im editing the UITextView

Ace Munim
  • 325
  • 3
  • 18
  • So you are looking for rounded corners, right? – Tarek Hallak Sep 07 '13 at 16:02
  • nop, Im looking for making a UITextField like that in the pic, if its possible though. – Ace Munim Sep 07 '13 at 16:03
  • It might be helpful if you tell us why you don't want to use a UITextView. – jcm Sep 07 '13 at 16:09
  • I want that when I start editing this `- (void)textFieldDidBeginEditing:(UITextView *)textField;` delegate would detect that Im editing the `UITextField` because I can't seem to detect when Im editing the `UITextView` – Ace Munim Sep 07 '13 at 16:15

2 Answers2

0

UITextField is one line only, you need to use UITextView instead, and if you are looking for rounded corners you can use:

self.commentTextField.clipsToBounds = YES;
self.commentTextField.layer.cornerRadius = 10.0f;

I suggest to check this question:

How to create a multiline UITextfield?

Community
  • 1
  • 1
Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
0

As others said, use UITextView instead of UITextField, just remebering of setting editable to YES.

And about the delegate, - (void)textFieldDidBeginEditing:(UITextView *)textField; is a method of UITextFieldDelegate , and, as the name of the protocol says, it will only work for UITextFields. Changing the type of the parameters will have no effect.

What you may want is the similar textViewDidBeginEditing: , of UITextViewDelegate. Implement this new protocol, just don't forgetting to set the delegate correctly.

self.textView.delegate = self;
Lucas Eduardo
  • 11,525
  • 5
  • 44
  • 49