getting started with xocde & iphone development

30
Developing iphone application's Using Xcode to build iOS apps. By KRISH

Upload: krishguttha

Post on 15-May-2015

348 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Getting started with Xocde & iPhone development

Developing iphone application's

Using Xcode to build iOS apps.

By KRISH

Page 2: Getting started with Xocde & iPhone development

Install Xcode

Join the iPhone Developer Program

Download the lastest version of the iOS (5) SDK along with the latest version of Xcode from https://developer.apple.com/

In this case, the version of Xcode 4.2 which includes iOS sdk 5.0

Page 3: Getting started with Xocde & iPhone development

Click on the iOS Dev Center

Page 4: Getting started with Xocde & iPhone development

Download Xcode and iphone SDK

Page 5: Getting started with Xocde & iPhone development

Install Xcode on your computer

Double click on downloaded Xcode Package to start the installation.

Page 6: Getting started with Xocde & iPhone development

Running Xcode on your computer

After successfully installed Xcode and iphone SDK.

Launch Xcode from /Developer/Application/Xcode

Page 7: Getting started with Xocde & iPhone development

Creating a new Project

StepsSteps Choose File > New > New Project. Select the project template for

your iOS or Mac OS X product, and click Next.

Enter the product name and other project details, and click Next.

Specify the project’s location in your file system, and click Create.

Page 8: Getting started with Xocde & iPhone development

From the screen appears, choose create a new Xcode project

Page 9: Getting started with Xocde & iPhone development

Or by choosing New Project from the File menu at any time

Page 10: Getting started with Xocde & iPhone development

Then choose Template application, pick product from IOS

Page 11: Getting started with Xocde & iPhone development

Enter the product name and other project details, and click Next.

Page 12: Getting started with Xocde & iPhone development

Specify the project’s location in your file system, and click Create.

Navigate to a place where you want to keep your projectSave as ,the name of the projectClick Save

Optional GIT Source Control if required check the box

Page 13: Getting started with Xocde & iPhone development

The project is createdClick RunTo check

Page 14: Getting started with Xocde & iPhone development

Running a project from Xcode

Page 15: Getting started with Xocde & iPhone development

The Application Life CycleThe Application Life CycleThe application life cycle constitutes the sequence of events that occurs between the launch and termination of your application.In iOS, the user launches your application by tapping its icon on the Home screen. Shortly after the tap occurs, the system displays some transitional graphics and proceeds to launch your application by calling its main function. From this point on, the bulk of the initialization work is handed over to UIKit, which loads the application’s user interface and readies its event loop.

This diagram shows the sequence of events that occur from the time the application starts up to the time it quits. At key points in the application’s life, UIKit sends messages to the application delegate object to let it know what is happening. During the event loop, UIKit dispatches events to your application’s custom event handlers.

Page 16: Getting started with Xocde & iPhone development

The Application DelegateMonitoring the high-level behavior of your application is the responsibility of the application delegate object, which is a custom object that you provide.

Delegation is a mechanism used to avoid subclassing complex UIKit objects, such as the default UIApplication object. Instead of subclassing and overriding methods, you use the complex object unmodified and put your custom code inside the delegate object.

As interesting events occur, the complex object sends messages to your delegate object.

We can use these “hooks” to execute your custom code and implement the behavior you need.

The application delegate object is responsible for handling several critical system messages and must be present in every iOS application.

The object can be an instance of any class you like, as long as it adopts the UIApplicationDelegate protocol.

Page 17: Getting started with Xocde & iPhone development

App States Not running State:  The app has not been launched or was running but was terminated

by the system.

Inactive state: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state. The only time it stays inactive for any period of time is when the user locks the screen or the system prompts the user to respond to some event, such as an incoming phone call or SMS message.

Active state: The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.

Background state:  The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state. For information about how to execute code while in the background, see “Background Execution and Multitasking.”

Suspended state:The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.

Applications running in iOS 4 and later can be in one of several different states at any given time.

Page 18: Getting started with Xocde & iPhone development

Launching into the active state

Page 19: Getting started with Xocde & iPhone development

Moving from the foreground to the background

Page 20: Getting started with Xocde & iPhone development

Handling application interruptions

1. The system detects an incoming phone call or SMS message, or a calendar event occurs. 2. The system calls your application delegate’sapplicationWillResignActive: method. The systemalso disables the delivery of touch events to your application.3. The system displays an alert panel with information about the event. The user can choose to ignore the event or respond to it.4. If the user ignores the event, the system calls your application delegate’s applicationDidBecomeActive: method and resumes the delivery of touch events to your application.5. If the user responds to the event instead of ignoring it, the system calls your application delegate’s applicationDidEnterBackground: method. Your application should move to the background as usual, saving any user data or contextual information needed to restore your application to its current state later.

Page 21: Getting started with Xocde & iPhone development

Event-Handling System

Page 22: Getting started with Xocde & iPhone development

Model-View-Controller

The pattern defines not only the roles objects play in the application, it defines the way objects communicate with each other.

MVC is central to a good design for a Cocoa application.

Page 23: Getting started with Xocde & iPhone development

About View Controllers

View controllers are a vital link between an app’s data and its visual appearance. Whenever an iOS app displays a user interface, the displayed content is managed by a view controller or a group of view controllers coordinating with each other. Therefore, view controllers provide the skeletal framework on which you build your apps.

iOS provides many built-in view controller classes to support standard user interface pieces, such as navigation and tab bars. As part of developing an app, you also implement one or more custom controllers to display the content specific to your app.

Page 24: Getting started with Xocde & iPhone development
Page 25: Getting started with Xocde & iPhone development

About Views

view objects are the main way your application interacts with the user, they have many responsibilities.Here are just a few:

Layout and subview management.Drawing and animation

Event handling

Page 26: Getting started with Xocde & iPhone development

 Layered views in the Clock application

Page 27: Getting started with Xocde & iPhone development

 View autoresizing mask constants

Page 28: Getting started with Xocde & iPhone development

Demo

Page 29: Getting started with Xocde & iPhone development

Questions?

Page 30: Getting started with Xocde & iPhone development

Thanks