ARTICLE

How to Change Background Color in iPhone and iPad

Posted by Sachin Bhardwaj Articles | iPhone/iPad November 02, 2012
In this article I will explain the procedure of changing the background color of a window in iPhone or iPad.
Reader Level:
Download Files:
 

Introduction

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.

Step 1

Open XCode by double-clicking on it.

Select-xcode-in-iphone.jpg

Step 2

Create a New XCode Project by clicking on it.

create-project-in-iphone.jpg

Step 3

Now select Empty Application and click on Next.

Empty-Application-in-iPhone.jpg

Step 4

Now give your Product Name. Here I give Background and Click on Next.

Project-name-in-iPhone.png

Step 5

Select the location you want to save your project to and click on Create.

save-project-location-in-iphone.jpg

Step 6

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.

1.Appdelegate.h
2.AppDelegate.m

Here we write code....

Appdelegate.h

code-of-AppDelegate.h-in-iPhone.png

Appdelegate.m

code-of-AppDelegate.m-in-iPhone.png

Here is the code where we change the color:

BackGround-color-code-in-iPhone.png

Step 7

Now select in which Platform you want to see the output.

Run-in-iPhone.png

Output

Output 1 in iPhone:

Output1-in-iPhone.png

Output 2 in iPhone:

Output2-in-iPhone.png

Output 1 in iPad:

Output1-in-iPad.png

Output 2 in iPad:

Output2-in-iPad.png

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter