개발/swift

How to change UITextField placeholder color?

lemonade 2021. 3. 5. 10:00
반응형

How to change UITextField placeholder color?

 

When you want to change UITextField placeholder color, there are two ways.

 

One way is using code, and the other way is using storyboard.

 

In code)

 

If you want to do it programmatically, you can use attributedString.

 

Replace "Placeholder" with 'real' placeholder and set color what you want.

 

 

In storyboard)

 

If you want to do it in storyboard, you can use user defined runtime attributes.

 

Key is 'placeholderLabel.textColor'

 

 

 

Enjoy codding :)

 

 

반응형
그리드형

'개발 > swift' 카테고리의 다른 글

How to make custom keyboard?  (0) 2021.04.12
Implement collectionview pull to refresh  (0) 2021.01.27
Swift scene delegate vs app delegate  (0) 2020.12.16
Swift How to init keychain when app deleted?  (0) 2020.12.12
Swift How to ignore return value?  (0) 2020.12.08