UITextField使用C#在iPhone上提示

时间:2013-05-29 18:40:50

标签: c# iphone xamarin.ios uitextfield xamarin

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

2 个答案:

答案 0 :(得分:7)

UITextFields有一个Placeholder属性,可以让你设置提示文本:

MyTextField.Placeholder = "Required";

答案 1 :(得分: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. link 2
  3. link 3
  4. 我希望它对你有所帮助。谢谢