Open Xcode

Embed Size (px)

Citation preview

  • 8/8/2019 Open Xcode

    1/57

    Ankit Gautam(0709113013)

    Atul Yadav(0709113020)Chetan Singh(0709113023)

    Chinki Singh(0709113024)

  • 8/8/2019 Open Xcode

    2/57

    iPhoney Internet and multimedia enabled

    smart phones.

    y Designed and marketed by

    Apple Inc.

    y Launched on Jan 9,2007.

  • 8/8/2019 Open Xcode

    3/57

    iPhone models iPhone(original)

    iPhone 3G

    iPhone 3GS

    iPhone 4

    iPhone 4 released on June 24,2010

    Approx 6.4 million iPhone users in U.S.

  • 8/8/2019 Open Xcode

    4/57

    iOSyApples mobile operating system.

    y Derived from Mac OS

    y Platform Dependent OS

  • 8/8/2019 Open Xcode

    5/57

    iPhone Applicationy Written in Objective-C.

    y Third Party Application.

    y SDK released on March 6,2008.

  • 8/8/2019 Open Xcode

    6/57

    iPhone SDKSDK consists of:

    y Xcode

    y Interface Builder

    y iPhone simulator

  • 8/8/2019 Open Xcode

    7/57

    Apple App Storey Upload/Download iPhone applications.

    y Uploading your applications Developer Registration

    Standard Package - $99/year.

    Enterprise Package - $299/year.

  • 8/8/2019 Open Xcode

    8/57

    Downloading an application.

    Select application from App Store.

    Do Payment to download the application.

    Price of application is set by the developer.

    70% of price/download - developer

    30% of price/download - Apple

  • 8/8/2019 Open Xcode

    9/57

    y iPhone application development HUGE MARKET

    y Till Sep 1,2010 No. of application in App Store : 2,50,000

    No. of downloads from App Store: 6.5 Billion

  • 8/8/2019 Open Xcode

    10/57

    XCode

  • 8/8/2019 Open Xcode

    11/57

    X Code IDE

    y X code is an IDE for creatingiPhone and Mac Applications.

    y X code comes with integrated

    Cocoa framework ,GNUcompiler,I phone simulator,

    Interface Builder.

    yX code supports developmentin languages such asC,C++,Objective C,ObjectiveC++.

  • 8/8/2019 Open Xcode

    12/57

    X Code Featuresy Source Editor.

    y Interface Builder.

    y iPhone Simulator.

    y Compilers.

    y Complete Documentation.

    y Cocoa Framework.

  • 8/8/2019 Open Xcode

    13/57

    Cocoa Frameworky The Cocoa frameworks consist of libraries, APIs, and

    runtimes that form the development layer for all of

    Mac OSX.y By developing with Cocoa, you will be creating

    applications the same way Mac OSXitself is created.

    yYour application will automatically inherit the great

    behaviors and appearances of Mac OSX.y Using Cocoa with theXcode IDE is simply the best way

    to create native Mac applications.

  • 8/8/2019 Open Xcode

    14/57

    I Phone Simulatory The iPhone Simulator

    runs your application inmuch the same way asan actual iPhone device .

    y It is quick to launch anddebug

    y It can even simulatetouch gestures by usingthe mouse.

  • 8/8/2019 Open Xcode

    15/57

    Interface Builder

    y Interface Builder allowsCocoa developer to createinterface for applications.

    y The resulting interface isarchieved as a .nib file .

    y The user interface objectscontain items like text fields,and pop-up menus ,buttons.

  • 8/8/2019 Open Xcode

    16/57

    y On running an application, the proper NIB objects are

    unarchived & connected with the binary of their

    owning application .

    y Interface Builder's palletes that contains user interface

    objects are completely extensible.

  • 8/8/2019 Open Xcode

    17/57

    Performance Analysis Tool

    y A truly unique application that helps you track theperformance of Mac OS X and iOS applications .

    y Instruments collects data such as disk, memory, or CPUusage in real time, either on your Mac or remotely from aconnected iPhone.

    y The data is graphically displayed as tracks over time,making it easy to pinpoint problem areas.

  • 8/8/2019 Open Xcode

    18/57

    X code Distinctive AspectyWhile code is written on it,it compiles code in the

    background.

    yWith ZERO LINK feature, only the files that arenecessary are linked at build time making linking veryfast.

    y Apple came up with Fix and Continue that allows youto find bugs, and fix them, without ever closing theapplication .

  • 8/8/2019 Open Xcode

    19/57

    y X code has the ability to distribute (over a networkusing bonjour protocol) the current build of your

    project to others running X code.

    y The Documentation Viewer in Xcode allows you to

    get vital information on various aspects of Xcode,

    Cocoa, Objective c etc.

  • 8/8/2019 Open Xcode

    20/57

    User Supporty Easy to learn.

    y Flexible.

    y Familiar interfaces.

    y Rapid development support.

  • 8/8/2019 Open Xcode

    21/57

    X code releasesy After 1.x,2.x,3.x series, recently X code 4 is released

    by Apple in June 2010.

    y X code 4 contains Interface Builder integrated in itunlike all other previous releases.

    y X code 4 has high performance LLVM compiler

    integrated in it.

    y Like LLVM, the new LLDB debugger engine is

    designed to consume much less memory, and be a

    rocket when it comes to performance.

  • 8/8/2019 Open Xcode

    22/57

    Objective-C

  • 8/8/2019 Open Xcode

    23/57

    Introductiony Objective-C is implemented as set of extensions to

    the C language.

    y It's designed to give C a full capability for object-oriented programming, and to do so in a simpleand straightforward way.

    y Its additions to C are few and are mostly based on

    Smalltalk, one of the first object-orientedprogramming languages.

    Objective-C 23

  • 8/8/2019 Open Xcode

    24/57

    Why Objective Cy Objective-C incorporates C

    y You can choose when to do something in an object-

    oriented wayy Objective-C is a simple language.

    y Objective-C is the most dynamic of the object-orientedlanguages based on C.

    y

    Most decisions are made at run time

    Objective-C 24

  • 8/8/2019 Open Xcode

    25/57

    Messagesy message expressions are enclosed in square brackets

    [receiver message]

    y The receiver is an object. The message is simply thename of a method and any arguments that are passedto it

    Objective-C 25

  • 8/8/2019 Open Xcode

    26/57

    Foundation Frameworky The Objective-C Foundation Framework is a

    essentially set of classes that are provided to speed and

    ease the process of developing applications usingObjective-C.

    y classes that comprise this framework all begin with theletters "NS (NSString,NSObject,NSDate etc)

    y

    #import

  • 8/8/2019 Open Xcode

    27/57

    String Constanty @This Is a String

    y NSString

  • 8/8/2019 Open Xcode

    28/57

    NSLogy Used as a print statement.

    y Example:NSLog(@HelloWorld);

  • 8/8/2019 Open Xcode

    29/57

    Calling Methods in Objective-Cy Other Languages

    myObject.someMethod();

    In Objective-C:

    [myObject someMethod];

  • 8/8/2019 Open Xcode

    30/57

    Methods that returns resulty Other Languages

    result=myObject.someMethod();

    In Objective-C:

    result= [myObject someMethod];

  • 8/8/2019 Open Xcode

    31/57

    Methods that takes a argumenty Other Languages

    myObject.someMethod(arg);

    In Objective-C:

    [ myObject someMethod : arg];

  • 8/8/2019 Open Xcode

    32/57

    Methods that takes multiple

    argumenty Other Languages

    title.insert(Today Only!,0);

    In Objective-C:

    [ title insertString:@Today Only! atIndex:0];

  • 8/8/2019 Open Xcode

    33/57

    Defining a Classy In Objective-C, classes are defined in two parts:

    y An interface that declares the methods and instance

    variables of the class .y An implementation that actually defines the class

    (contains the code that implements its methods)

    Objective-C 33

  • 8/8/2019 Open Xcode

    34/57

    The Interface :Student.h#import

    @interface Student:NSObject{

    //iVarsint rollno;

    NSString *name;

    }

    //public methods

    -(void) print;-(void) setRollno : (int ) r;

    -(void) setName : (NSString *) n;

    @end

    Objective-C 34

  • 8/8/2019 Open Xcode

    35/57

    The Implementation:Student.m#import@implementataion Student-(void) print{

    NSLog(@Roll No:%i ,Name:%@,rollno,name);}-(void) setRollno : (int) r{

    rollno=r;}

    -(void) setName: (NSString *n) {name=n;

    }@end

  • 8/8/2019 Open Xcode

    36/57

    main.m#import import Student.hint main(int argc, const char *argv[]) {

    Student *a=[Student new];[a setName: @ATUL ];[a setRollno: 20 ];[a print];

    return 0;}

  • 8/8/2019 Open Xcode

    37/57

  • 8/8/2019 Open Xcode

    38/57

  • 8/8/2019 Open Xcode

    39/57

  • 8/8/2019 Open Xcode

    40/57

  • 8/8/2019 Open Xcode

    41/57

  • 8/8/2019 Open Xcode

    42/57

  • 8/8/2019 Open Xcode

    43/57

    Declarationy Instance Variablesfloat width;

    float height;

    BOOL filled;NSColor *fillColor;

    yMethods:y names of methods that can be used by class objects,

    class methods, are preceded by a plus sign

    + allocy methods that instances of a class can use, instance

    methods, are marked with a minus sign:

    - (void) display;

    Objective-C 43

  • 8/8/2019 Open Xcode

    44/57

    Memory Managementy Manage memory for every object you create.

    y If you own a object,it is your responsibility to release it.

    after the use[object release]

  • 8/8/2019 Open Xcode

    45/57

    Sample iPhone

    Application

  • 8/8/2019 Open Xcode

    46/57

    Open Xcode

    Select an already made

    application or make a newapplication

  • 8/8/2019 Open Xcode

    47/57

    Write code

    Make all necessary files &

    add all the resources whichwill be needed in yourapplication

  • 8/8/2019 Open Xcode

    48/57

    Build & Run Application

    Application is loaded into iPhone simulator

  • 8/8/2019 Open Xcode

    49/57

    Home page of Application

    View Controller of Main Window is opened

  • 8/8/2019 Open Xcode

    50/57

    Title view is displayed

    View Controller of this view was initialized in previousView Controller

  • 8/8/2019 Open Xcode

    51/57

    View Description

    Alert view pops up on clicking any row of Table view showing

    description of that Topic.

  • 8/8/2019 Open Xcode

    52/57

    Technical Aspects OfThis

    Application

    Four Pillars of anyView Based Application

    xib window

    Inspector window

    Library window

    View window

  • 8/8/2019 Open Xcode

    53/57

    xib window

    Gives description of all the

    Outlets and Methodsdeclared in class.

    Associated with a particularView Controller class.

  • 8/8/2019 Open Xcode

    54/57

    Inspector Window

    Properties of any object can be set or changed

  • 8/8/2019 Open Xcode

    55/57

    Library window

    Objects can be added into view by dragging them from this window

  • 8/8/2019 Open Xcode

    56/57

    View window

    This is the window where objects are displayed

  • 8/8/2019 Open Xcode

    57/57

    Thank You