Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Change the PlaceHolder colour

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 352
    Comment on it

    As we know that we can't change the place holder color of the Text Fields but sometimes if we need to change it then we can do it by using following code.

    UIColor *color = [UIColor grayColor];
    self.myTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Username" attributes:@{NSForegroundColorAttributeName:color}];

    Here, First we have to make a instance of UIColor type, and assign any color to it for example we need to display the text of the Text Field in gray Color so we have written greyColor.

     

    In next line code myTextFeild is the Text Field's outlet whose placeholder color we want to change. We have also mentioned one string i.e @"Username" , it is the text which would be written in the Text Field.

     

    so in this way we can change the place holder color of a Text Field.

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: