iPhone Development using Objective C – Xcode

Learn how to make Mobile Applications was one of my main goals in taking Interactive Multimedia program at Sheridan College. Prof. Dan Zen gave us a quick overview of Xcode and we developed a quick application using Date Picker Component.

What is Xcode:
Xcode is a suite developed by Apple, for developing software for Mac OS X or iOS. If you are a registered developer, Xcode can be downloaded for free from Apple Developer website (http://developer.apple.com/xcode/). The Xcode suite includes most of Apple’s developer documentation and Interface Builder, an application used to construct graphical user interface. Objective C is an Object Oriented, C based programing language used to develop most Mac Application and Xcode is based on Obective C.

My Experiments with Xcode:
As I don’t have a Mac I did my experiments with my friend in her Mac. First we created a new Xcode project. The two files in which we coded are .h and .m files. The Interface Builder is where we can see the views and add components.

Code for DateViewController .m file:

// DateViewController.m
// Created by Florence Kwok on 11-03-15.
// Copyright 2011 __MyCompanyName__. All rights reserved.

#import “DateViewController.h”

@implementation DateViewController
@synthesize myLabel, myPicker;

// The designated initializer. Override to perform setup that is required before the view is loaded.
– (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
return self;

// Implement loadView to create a view hierarchy programmatically, without using a nib.
– (void)loadView {

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
– (void)viewDidLoad {
[super viewDidLoad];

NSLog(@”Hi from IMM”);

– (IBAction)setDate: (id)sender{

//myLabel.text= myDate;

NSDate *myDate2 = myPicker.date;

myLabel.text= myDate2.description;

NSString *myDate = myDate2.description;
NSLog(@”Date Picked = %@”, myDate);


// Override to allow orientations other than the default portrait orientation.
– (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);

– (void)didReceiveMemoryWarning {
// Releases the view if it doesn’t have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren’t in use.

– (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;

– (void)dealloc {
[super dealloc];


Code for DateViewController.h file:

// DateViewController.h
// Created by Florence Kwok on 11-03-15.
// Copyright 2011 __MyCompanyName__. All rights reserved.


@interface DateViewController : UIViewController {
IBOutlet UILabel *myLabel;
IBOutlet UIDatePicker *myPicker;
@property (nonatomic, retain) IBOutlet UILabel *myLabel;
@property (nonatomic, retain) IBOutlet UIDatePicker *myPicker;
– (IBAction)setDate: (id)sender;

Image of Date Picker App:

Links for help:

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s