Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color and font of UITextField Placeholder in Xamarin for iOS7

Tags:

ios7

xamarin

using(UIFont font=StyleHelper.Fonts.HelveticaNeueLTDMC_18
using(UIColor color=UIColor.Clear.FromHex(0xc7c7c7))
{
    color.SetFill ();

    base.DrawString (this.Placeholder, rect, font);

}

I am using above code but it is not working.

like image 416
Mahesh Bansode Avatar asked Jan 12 '23 21:01

Mahesh Bansode


1 Answers

As seen on the iOS-API documentation for MonoTouch.UIKit.UITextField.AttributedPlaceholder, you can clearly see:

myLogin.AttributedPlaceholder = new NSAttributedString (
    "Enter your credentials",
    font: UIFont.FromName ("HoeflerText-Regular", 24.0f),
    foregroundColor: UIColor.Red,
    strokeWidth: 4 
);
like image 134
Jack Avatar answered May 15 '23 12:05

Jack