close
hex-to-uicolor
It is very easy to find the exact color you want with hex code. In this tutorial you can convert Hex to UIColor. I’m sharing a simple method that convert Hex to UIColor which you can make in your parent class and call anytime you need a color.

Do this in your parent class of View. You will need this function in many classes so it’s a good approach to do that.

Create this in .m file it will get a Hex value and return it’s UIColor:


In your .h file assign:

Call the Method

Some properties require UIColor and some requires CGColor. If it requires UIColor call the above method as:


Some properties like CAShapeLayer requires CGColor you can use the same method as:
Tags : convert Hex to UIColor
Chaudhary Talha

The author Chaudhary Talha

I’m an iOS developer by profession and UI/UX designer by passion. All my tutorials are based on my personal experiences and whenever I learn something new I share it with the world.