2013-05-29 23 views
1

我想在我的iPhone应用程序的UITextField中放置临时文本。 Android有提示属性在文本字段中显示临时文本。我如何在iPhone开发中做同样的事情?UITextField提示在iPhone上使用C#

+0

临时文本意味着占位符? – jamil

+0

是的,我如何将占位符文本放入C#中的UITexField中? –

+0

看看这里http://stackoverflow.com/a/11479680/1328096 – jamil

回答

6

UITextFields有让您设置的提示文本占位符属性:

MyTextField.Placeholder = "Required"; 
1

有二手占位为UITextField不同的方法如下

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; 
  1. link 1
  2. 一些好办法给出
  3. link 2
  4. link 3

我希望它能帮助周到,谢谢