C# NSAttributedString在UITextField ios xamarin上不起作用

C# NSAttributedString在UITextField ios xamarin上不起作用,c#,ios,xamarin.ios,xamarin,C#,Ios,Xamarin.ios,Xamarin,在UITextField中更改占位符的字体和字体大小时遇到问题 this.emailTextField = new UITextField (); //Not working this.emailTextField.AttributedPlaceholder = new NSAttributedString ("Email address", UIFont.FromName("Didot-Italic", 6.0f)); this.emailTextField.KeyboardType =

在UITextField中更改占位符的字体和字体大小时遇到问题

this.emailTextField = new UITextField ();

//Not working
this.emailTextField.AttributedPlaceholder = new NSAttributedString ("Email address", UIFont.FromName("Didot-Italic", 6.0f));

this.emailTextField.KeyboardType = UIKeyboardType.EmailAddress;
this.emailTextField.ReturnKeyType = UIReturnKeyType.Next;
this.emailTextField.AdjustsFontSizeToFitWidth = true;
this.emailTextField.ClearButtonMode = UITextFieldViewMode.Always;
this.emailTextField.BackgroundColor = UIColor.White;
this.emailTextField.BorderStyle = UITextBorderStyle.None;

var bottomLayer = new CALayer ();
bottomLayer.BorderColor = UIColor.Black.CGColor;
bottomLayer.BorderWidth = 1;
bottomLayer.Frame = new RectangleF (0, 29, 200, 1);

this.emailTextField.Layer.AddSublayer (bottomLayer);
this.emailTextField.Frame = new RectangleF (60, this.fbButton.Frame.Bottom + 20, 200, 30);

你可以试着像下面那样使用它。到目前为止,这对我很有效

this.emailTextField.AttributedPlaceholder = new NSAttributedString ("Email address", new UIStringAttributes{Font = UIFont.FromName("Didot-Italic", 6.0f)});

根本不工作…调试时字体仍然是系统字体,大小为17。您是否检查了字体添加是否正确?例如,当您将此字体设置为textfield的字体时,它是否工作?