Getting started with Xocde & iPhone development


Published on

Published in: Technology, News & Politics
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Getting started with Xocde & iPhone development

  1. 1. Developing iphone applications Using Xcode to build iOS apps. By KRISH
  2. 2. Install Xcode Join the iPhone Developer Program Download the lastest version of the iOS (5) SDK along with the latest version of Xcode from In this case, the version of Xcode 4.2 which includes iOS sdk 5.0
  3. 3. Click on the iOS Dev Center
  4. 4. Download Xcode and iphone SDK
  5. 5. Double click on downloaded Xcode Package to start the installation.Install Xcode on your computer
  6. 6.  Aftersuccessfully installed Xcode and iphone SDK. Launch Xcode from /Developer/Application/XcodeRunning Xcode on your computer
  7. 7. Steps 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. Creating a new Project
  8. 8. From the screen appears, choosecreate a new Xcode project
  9. 9. Or by choosing New Project from theFile menu at any time
  10. 10. Then choose Template application, pick product fromIOS
  11. 11. Enter the product name and other project details, and click Next.
  12. 12. Specify the project’s location in your file system, and click Create. Navigate to a place where you want to keep your project Save as ,the name of the project Click Save Optional GIT Source Control if required check the box
  13. 13. Click RunTo check The project is created
  14. 14. Running a project from Xcode
  15. 15. The Application Life Cycleapplicationthe cycle The constitutes life 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 thetime it quits. At key points in the application’s life, UIKit sends messages to the application delegateobject to let it know what is happening. During the event loop, UIKit dispatches events to yourapplication’s custom event handlers.
  16. 16.  The Application Delegate Monitoring the high-level behavior of your application is theresponsibility of the application delegate object, which is a customobject that you provide. Delegation is a mechanism used to avoid subclassing complexUIKit objects, such as the default UIApplication object. Instead ofsubclassing and overriding methods, you use the complex objectunmodified and put your custom code inside the delegate object. As interesting events occur, the complex object sends messagesto your delegate object. We can use these “hooks” to execute your custom code andimplement the behavior you need. The application delegate object is responsible for handlingseveral critical system messages and must be present in everyiOS application. The object can be an instance of any class you like, as long as it
  17. 17. 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- Applications running in iOS 4 and latersystemin one purge suspendedstates at any given time. make memory condition occurs, the can be may of several different apps without notice to more space for the foreground app.
  18. 18. Launching into the active state
  19. 19. Moving from the foreground to the background
  20. 20. 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 system also 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.Handling application interruptions
  21. 21. Event-Handling System
  22. 22. 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. Model-View-Controller
  23. 23. View controllers are a vital link between an app’sdata and its visual appearance. Whenever an iOS appdisplays a user interface, the displayed content ismanaged by a view controller or a group of viewcontrollers coordinating with each other. Therefore,view controllers provide the skeletal framework onwhich you build your apps. iOS provides many built-in view controller classesto support standard user interface pieces, such asnavigation and tab bars. As part of developing an app,you also implement one or more custom controllers todisplay the content specific to your app. About View Controllers
  24. 24. 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 About Views
  25. 25.  Layered views in the Clock application
  26. 26.  View autoresizing mask constants
  27. 27. Demo
  28. 28. Questions?
  29. 29. Thanks