Create UIView with gradient background

Add gradient background to UIView using CAGradientLayer

Using CAGradientLayer

CAGradientLayer is a layer that draws gradient color over its background.

By default color are spread evenly but you can control the locations of them.

CAGradientLayer example

The following function will add a gradient layer to the view passed to it Continue reading “Create UIView with gradient background”

Execution States of iOS Application

As an iOS developer you should know the different states of iOS app and understand the difference between them

At any given moment your iOS app will be in one of those states listed below

iOS app states

Not Running

You app will be in this state if it was not launched yet or was terminated by the system.


This is a transition state, your app goes in Inactive state for a short time when launching it. Continue reading “Execution States of iOS Application”

Atomic and Nonatomic properties in Objective C

The favorite interviewer’s question for iOS developers

What is the difference between Atomic and Nonatomic properties in iOS

This has been the favorite question in iOS developer job interviews for many years.

And it is also the first question a beginner iOS developer ask once he sees the declaration of a property in Xcode like this:

@property (nonatomic , strong) NSString *firstName;

The short answer is: Continue reading “Atomic and Nonatomic properties in Objective C”