How to Create Custom Button for IPhone and iPad

Introduction

This is a simple program for beginners. In this article we create a custom button which is created in code, in other words we doesn't use Nib files. Using this button we perform the action of printing "Hello Word" on itself.

Step 1

Open XCode by double-clicking on it.

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 project a Name. Here I use Product Name Custombutton and Company Identifier Mcn Solutions and click on Next.

project-name-in-iPhone.jpg

Step 5

Select the location where 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 are automatically generated by XCode. 

view-of-xcode-in-iphone.jpg

In an Empty Application, never generate a UIViewController class if you want to create it manually.

1.Appdelegate.h
2.AppDelegate.m

Here we write code....

Appdelegate.h

code-of-appdeleage.h-class-in-iphone.jpg

Appdelegate.m

code-of-appdeleage.m-class-in-iphone.jpg

Step 7

Select which Platform you want to see the output in.

how-to-run-application-in-simulator-in-iphone.jpg

Output

custom-button-on-iPhone.jpg

hello-on-iphone.jpg


custom-button-on-iPad.jpg

hello-on-ipad.jpg


Happy coding!!!

Up Next
    Ebook Download
    View all
    Learn
    View all