Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize UITextField like this?

another questions...

How can i make this textfield??

alt textalt text

With on the left a FIXED placeholder with a string and after it, an touchable zone, with text or the blue rectangle like screenshot.

I need to implement a view? Or there is a simple way to do it directly in textfield?

thanks again!
A

like image 473
elp Avatar asked Jan 22 '11 18:01

elp


1 Answers

I have the solution!!!

UITextField have a property named leftView and rightView!

Here's the code:

UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(1, 1, 60, 25) ];
[lbl setText:@"Partenza:"];
[lbl setFont:[UIFont fontWithName:@"Verdana" size:12]];
[lbl setTextColor:[UIColor grayColor]];
[lbl setTextAlignment:NSTextAlignmentRight];
_txtFrom.leftView = lbl;
_txtFrom.leftViewMode = UITextFieldViewModeAlways;
_txtFrom.delegate = self;

and this is the output:
enter image description here

like image 108
elp Avatar answered Sep 21 '22 03:09

elp