I'd like to place temporary text in the UITextField
on my iPhone app. Android has the hint property to display temporary text in the textfield. How do I do the same in iPhone development?
Asked
Active
Viewed 3,235 times
1

Adrian Wragg
- 7,311
- 3
- 26
- 50

Yahiko Kikikoto
- 688
- 3
- 12
- 23
-
Temporary text means place holder? – jamil May 29 '13 at 18:41
-
Yes, how do I put placeholder text into a UITexField in C#? – Yahiko Kikikoto May 29 '13 at 18:43
-
take a look here http://stackoverflow.com/a/11479680/1328096 – jamil May 29 '13 at 18:46
-
if you are thinking of pop-up or flyover a text field, that's not a supported in ios. – Sam B May 29 '13 at 21:17
2 Answers
7
UITextFields have a Placeholder property that let you set the hint text:
MyTextField.Placeholder = "Required";

Ben Bishop
- 1,414
- 9
- 14
1
There are different approaches to used place holder for UITextfield some good way given below
CGRect frame = CGRectMake(0, 0, 160, 29);
UITextField *search= [[UITextField alloc] initWithFrame:frame];
search.borderStyle = UITextBorderStyleRoundedRect;
search.textColor = [UIColor blackColor];
search.font = [UIFont systemFontOfSize:17.0];
search.placeholder = @"Suchen";
search.backgroundColor = [UIColor clearColor];
search.autocorrectionType = UITextAutocorrectionTypeNo;
search.keyboardType = UIKeyboardTypeDefault;
search.returnKeyType = UIReturnKeySearch;
search.clearButtonMode = UITextFieldViewModeWhileEditing;
search.delegate = self;
I hope it helps you.Thanks