In this article we change the background color of a UI Window of iPhone via coding in the appdelegate.m class. To better understand use the following procedure.
Open XCode by double-clicking on it.
Create a New XCode Project by clicking on it.
Now select Empty Application and click on Next.
Now give your Product Name. Here I give Background and Click on Next.
Select the location you want to save your project to and click on Create.
Now you will see only two Objective-C Classes which were automatically generated by XCode. In the Empty Application never generate a UIViewController class; if you want, you can create it manually.
Here we write code....
Here is the code where we change the color:
Now select in which Platform you want to see the output.
Output 1 in iPhone:
Output 2 in iPhone:
Output 1 in iPad:
Output 2 in iPad: