1 / 28

Using Xcode

Using Xcode. A Beginner’s Tutorial Erin Green. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications We will explore its different parts and their functions This tutorial will teach you how to use Xcode, but not how to build an app.

tess
Télécharger la présentation

Using Xcode

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using Xcode A Beginner’s Tutorial Erin Green

  2. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications • We will explore its different parts and their functions • This tutorial will teach you how to use Xcode, but not how to build an app. • To build an app, you need to know Objective-C.

  3. Why should I learn this? • Learning the ins and outs of Xcode will help you to be more comfortable if you decide to attempt Objective-C later. • Lots of libraries are creating apps to promote themselves and connect with their patrons.

  4. Before We Begin… You need a computer running Mac OS 10.6 or better A familiarity with programming helps Download the Xcode installer from the Apple app store The current version available is Xcode 4 It’s free! Open the .dmg file and install to your hard drive

  5. Useful Terms • Objective-C: the programming language used to write iOS applications, based on C and using object oriented programming methods • Object: a collection of code with its data and ways to manipulate that data

  6. Useful Terms • View: how your program presents information to the user • Model: how your data is represented inside of your application • Like a card catalog behind the scenes of your app • A ‘model object’ would be an individual card

  7. Let’s Start a New Project Open Xcode in your applications folder Choose File  New  New Project Choose your app template

  8. App Templates Page-Based: For apps with 2 views, such as the Maps app. 1 main page and 1 details/info page Master-Detail App: Like the iOS email app, works on parent/child relationships Open GL: allows for 3D hardware and animation timers. Good for games. Single View: A single screen. Fairly simple apps with the views remaining on one ”background”

  9. App Templates, Pt 2 Tabbed: Like the iPod app, with lots of different ways to view the same database items Empty: You build everything from scratch Utility: Like the weather app, a main view and a configuration view

  10. Starting an App Choose the name you want for your app Click ‘Next’ Choose a folder in which to save your app Finally, choose your device Writing a universal iOS app is more difficult than writing for just one device

  11. This is what your screen looks like now….

  12. The main parts we’ll be focusing on… 1. Navigator Panel 2. Inspector Panel 3. Libraries

  13. Navigator Panel

  14. The Classes folder contains two objects: - The App Delegate - The View Controller The extensions: - .h = header, defines object - .m= main/body -.xib= XML interface builder

  15. The App Delegate • Handles starting and ending your app • Serves as a go-between between iOS and your app • Hands off control to your code after starting

  16. The View Controller • Handles everything that shows up on screen • Handles all the info that the onscreen objects need to display themselves • Translates between the view and the model • Responds to user input and uses that to change model data • Responsible for updating view from the model

  17. To help visualize… From developer.apple.com

  18. XML Interface Builder This is where you lay out graphic views The view controller knows how to talk to the objects that have been created here Lots of formatting options

  19. Supporting Files, Pt. 1 • These are system files • .plist = property list • Appname-Info.plist = contains info about your app for the iOS. It is an XML file that includes the options you put on your app (which device, etc.) • InfoPlist.strings = helps to internationalize your app • Language translation cues • .strings is any text

  20. Supporting Files, Pt. 2 • Main.m = low level. Starts app and gives to the App Delegate. Never change this file. • .pch = pre-compiled header • Appname-Prefix.pch = generated by the system to speed up builds

  21. Frameworks Frameworks contains a lot of already written code provided by the system - A library of code bits - Related to the Libraries menu on the right of Xcode UIKit = contains code for everything that interfaces with the user (views) Foundation = alll the components used to build the model CoreGraphics = handles drawing on the screen

  22. Products Where built apps are stored

  23. Inspector Panel • This area contains utilities panels that let you change properties of your app’s view objects, like: • Colors • Sizes • Images • Button actions

  24. Libraries • Different goodies depending on which icon you click • From left to right: • File templates • Code snippets • View Objects • Media/Images

  25. Tips and Tricks • If you’re unsure about what a piece of code does, you can get help from Xcode: • Hold ‘Option’ and click on the mystery code piece • A “quick help” balloon will appear with a definition

  26. Tips and Tricks You can also click in the upper right corner on the Inspector Panel to get the same help. While you’re coding, Xcode will often begin to auto-complete your code. Select what you want from the list it gives. It’s a good time-saver.

  27. References For additional help, you can try: Mark, D., & LaMarche, J. (2009). Beginning iPhone 3 development: Exploring the iPhone SDK. Berkeley, CA: Apress. Or The Apple Developer web site at http://developer.apple.com/

  28. Now you’re ready to begin experimenting in Objective-C using Xcode. Have fun!

More Related