iPhone Application Development




Yesterday when i was using Google plus there was a group in which a person asked a question that how can i start  iPhone Application development so i was replied him that tomorrow i will told you about this means today so thats why i share this post in very steps which is mentioned given below with screenshots  I planning to write a iPhone and iOS application development tutorial series for this you need a Mac iOS and Xcode IDE.Just follow the steps and you can make a application.just follow the given steps you can create a  simple and beautiful " HELLO WORLD " program.

 Step 1:

 First you need to open the XCode  and click the new project which is show in below image.





Step 2

Then you select an empty appliction







Step 3

After selecting the empty appliction then a new window will open  in this you need to enter the device name as iphone, and product name hellophone.





 Step 4

After Doing the above step you will set the project and click the Next button.

 


 Step 5
When you clik the next your project will be shown as:



 

 Step 6
 In this project property windows contains some app delegates files and such other supporting files you need to right click on the project folder and select the new files as shown in the image which is mentioned below


 


Step 7

After doing the above method you need to select the objective-c class and click the next

 


Step 8

Rename the class to homescreen(what ever you wish) and select UIViewController in the Subclass of dropdown and check the “with XIB for user interface” to include user interface file and click next


























Step 9

This option will ask you to choose the location of your create file dont change the default location you need to click create button with out any changing 






















Step 10

After completing the above steps your home screen has been successfully created and it will look like below image.
























Now open homescreen.h file and create a UIButtonField with its onclick function programmatically with the below mentioned code.

@interface homescreen : UIViewController
{
IBOutlet UIButton *btn_hello;
}

@property(nonatomic, retain)IBOutlet UIButton *btn_hello;

-(IBAction)btn_hello_click;

@end

Now your homescreen.h file will look like this





When your homescreen.m created then open it and synthesize your button field at top and add a alert box in the button click function as shown below:

@synthesize btn_hello;

-(IBAction)btn_hello_click
{
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Success !!!"
message:@"Hello iPhone"
delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
[alertView release];
}

The memory allocated by the button has to be released manually as shown below:
 
 
- (void)dealloc
{
[btn_hello release];
[super dealloc];
}


After adding the above code your homescreen.m file will look like this





























Step 11

So completing the above 10 steps its time to design so open the homescreen.xib file and drag a button in the right side object window and drop it in the view controller. 

























Step 12
Then double Click on the button and enter text as "Click Me !"



Step 13

Now under objects panel on left side, right click on the button as shown below



Step 14
Now click on the “Touch Down” option and link it to “File’s Owner” as show below.





Step 15
Now the button click function declared in header and main file will get pop up.
























Step 16
Select the function. This process will link the function to the button click event.




So design part is over. Now your application is ready. But, the problem is this is an empty application. Application don’t know where to start. So we need to redirect the application to the home screen.
Open Appdelegate.h file and declare UINavigationController as shown below






@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UINavigationController *navigationController;
}

@property(strong,nonatomic)UINavigationController *navigationController;

@property (strong, nonatomic) UIWindow *window;

@end




Your Appdelegate.h file will look like this



Step 16
Now open AppDelegate.m file and mention the homescreen to be the start point of the application as shown below


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIViewController *homeController = [[homescreen alloc] initWithNibName:@"homescreen" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:homeController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}


Step 17
Your AppDelegate.m file will look like below image. Now it’s done. Click on the run icon on the top left corner as shown in below image.



Step 18
It will take few min to open the iphone simulator and your project. Your application will look like below image



























Step 19
Now click the “Click Me !” button.



























Congratulations. You are now a iPhone developer if there is any mistake then please tell me in comments  i will try to my best.

wish you best of luck 

Post a Comment

CodeNirvana
Newer Posts Older Posts
© Copyright Softwares Zone
Back To Top