Step 1
Create a new Project in X Code by selecting File --> New Project and then required optionsStep 2
Create a new File by selecting File --> new File --> CoCoa Touch Class.Select option of create Xib in the same window
Here three files will be generated sample.h , sample.m and sample.xib
Step 3
Sample.xib is like xml file in android.Open it and drag and drop the required component Button
Step 4
Open the AppDelegate.m file then load the required Xib file (Sample.xib) in the didfinishlaunchingwithoptions method
If you run should be able to see the designed interface
Step 5
Create outlets by selecting a component in xib file and dragging it to the interface .h file
Step 6
Create a method like buttonPressed in sample.controller
like
-(IBAction)buttonPressed:(id)sender
{
//do the necessary things
}
like
-(IBAction)buttonPressed:(id)sender
{
//do the necessary things
}
Step 7
Go to xib file right click on the button and then select action like TouchDown and drag it to the fileowner where you can see the method which you have defined
Step 8
Build and Run
No comments:
Post a Comment