Open Xcode
Open Xcode
Development
Ankit Gautam(0709113013)
Atul Yadav(0709113020)
Chetan Singh(0709113023)
Chinki Singh(0709113024)
iPhone
Internet and multimedia enabled
smart phones.
Platform Dependent OS
iPhone Application
Written in Objective-C.
Xcode
Interface Builder
iPhone simulator
Apple App Store
Upload/Download iPhone applications.
Flexible.
Familiar interfaces.
Objective-C 23
Why Objective C
Objective-C incorporates C
You can choose when to do something in an object-
oriented way
Objective-C is a simple language.
Objective-C is the most dynamic of the object-oriented
languages based on C.
Most decisions are made at run time
Objective-C 24
Messages
message expressions are enclosed in square brackets
[receiver message]
The receiver is an object. The message is simply the
name of a method and any arguments that are passed
to it
Objective-C 25
Foundation Framework
The Objective-C Foundation Framework is a
essentially set of classes that are provided to speed and
ease the process of developing applications using
Objective-C.
classes that comprise this framework all begin with
the letters "NS“ (NSString,NSObject,NSDate etc)
#import <Foundation/Foundation.h>
String Constant
@”This Is a String”
NSString
NSLog
Used as a print statement.
Example: NSLog(@”Hello World”);
Calling Methods in Objective-C
Other Languages
myObject.someMethod();
• In Objective-C:
[myObject someMethod];
Methods that returns result
Other Languages
result=myObject.someMethod();
• In Objective-C:
myObject.someMethod(arg);
• In Objective-C:
title.insert(“Today Only!”,0);
• In Objective-C:
Objective-C 33
The Interface :Student.h
#import <Foundation/Foundation.h>
@interface Student:NSObject{
//iVars
int rollno;
NSString *name;
}
//public methods
-(void) print;
-(void) setRollno : (int ) r;
-(void) setName : (NSString *) n;
@end
Objective-C 34
The Implementation:Student.m
#import<Student.h>
@implementataion Student
-(void) print{
NSLog(@”Roll No:%i ,Name:%@”,rollno,name);
}
-(void) setRollno : (int) r{
rollno=r;
}
-(void) setName: (NSString *n) {
name=n;
}
@end
main.m
#import <Foundation/Foundation.h>
import “Student.h”
int main(int argc, const char *argv[]) {
Objective-C 43
Memory Management
Manage memory for every object you create.
If you own a object,it is your responsibility to release
it.
after the use
[object release]
Sample iPhone
Application
Open Xcode
Select an already made
application or make a new
application
Write code
Make all necessary files &
add all the resources which
will be needed in your
application
Build & Run Application
Application is loaded into iPhone simulator
Home page of Application
View Controller of Main Window is opened
Title view is displayed
View Controller of this view was initialized in previous View Controller
View Description
Alert view pops up on clicking any row of Table view showing
description of that Topic.
Technical Aspects Of This Application
Four Pillars of any View Based Application
xib window
Inspector window
Library window
View window
xib window
Gives description of all the
Outlets and Methods
declared in class.
Associated with a particular
View Controller class.
Inspector Window
Properties of any object can be set or changed
Library window
Objects can be added into view by dragging them from this window
View window
This is the window where objects are displayed
Thank You