Introduction
In this article we create two custom buttons designed by code. In other words in this we don't use Xib (XCode Interface builder) or Nib files. In this when we click on the first button (Purple color) it give its output on the second button (Red color) and when we click on the second button (Red color) it give its output on the first button (Purple color). I will explain how it works step-by-step here...
Step 1
Open XCode using double-click on it.
Step 2
Create a New XCode Project via clicking on it.
Step 3
Now select Empty Application and click on Next.
Step 4
Now give your Product Name. Here I use userdefinedcontrol and Company Identifier Mcn Solutions and click on Next.
Step 5
Select the location where you want to save your project and click on Create.
Step 6
Now you will see only two Objective C Classes automatically generated by XCode. An Empty Application never generates a UIViewController class.
1.Appdelegate.h
2.AppDelegate.m
Here we write code....
1.Appdelegate.h
2.Appdelegate.m
Step 7
Now select which Platform you want to see output for.
Output
Output 1 in iPhone:
Here click on the first button (Purple color).
Output 2 in iPhone:
Output "I Love" shows on the second button (Red color).
Output 3 in iPhone:
Here we click on the second button (Red color); it shows the output "INDIA" on the first button (Purple color).
Output 1 in iPad
Here when we click on the second button (Red color) it gives its output on the first button (Purple color).
Output 2 in iPad:
Output "INDIA" show on first button (Purple color).
Output 3 in iPad
Here we click on the first button (Purple color) it shows the output "I Love" on the second button (Red color).