---
title: "Define Gradient color in iOS."  
description: "Define Gradient color in iOS."  
author: "Tarun Kumar"  
published: 2015-12-30  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/22959/define-gradient-color-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 2 minutes  

---

# Define Gradient color in iOS.

Quartz provides two opaque data types for creating gradients—CGShadingRef and CGGradientRef. We can use either of these to create axial or radial gradients. A Gradient is a filling of color that varies from one color to another color.

***There are main two types of gradients, that are as follows:***\
**1. Axial Gradient:** It is described by 2 points, different color is available at each point. All points that lie on a line perpendicular to the axis have the same color value.\
**2. Radial gradient:** It is described by circle where one color available at centre and changes when moving towards the edges and gradient radius of circular sections are defined by the radii of the end circles. and the radius of each intermediate circle varies linearly from one end to the other.

## Answers

### Answer by Tarun Kumar

Quartz provides two opaque data types for creating gradients—CGShadingRef and CGGradientRef. We can use either of these to create axial or radial gradients. A Gradient is a filling of color that varies from one color to another color.

***There are main two types of gradients, that are as follows:***\
**1. Axial Gradient:** It is described by 2 points, different color is available at each point. All points that lie on a line perpendicular to the axis have the same color value.\
**2. Radial gradient:** It is described by circle where one color available at centre and changes when moving towards the edges and gradient radius of circular sections are defined by the radii of the end circles. and the radius of each intermediate circle varies linearly from one end to the other.


---

Original Source: https://www.mindstick.com/interview/22959/define-gradient-color-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
