Encontre seu próximo livro favorito
Xcode 4 iOS Development Beginner's Guide
Descrição
The iPhone is one of the hottest mobile devices on the planet. Whether you are just starting out with iOS Development or already have some knowledge in this area, you will benefit from what this book covers. Using this book's straightforward, step-by-step approach, you will go from Xcode 4 apprentice to Xcode 4 Jedi master in no time.
Xcode 4 iOS Development Beginner's Guide will help you learn to build simple, yet powerful applications for the iPhone from the ground up. You will master the Xcode 4 tools and skills needed to create applications that are simple yet, like Yoda, punch far above their weight.
You will start by learning about the Xcode 4 Development Tools, Xcode IDE, iOS Simulator, Objective-C 2, and Organizer. Then you will jump straight in and create applications using Xcode and Interface Builder. You finish up by learning how to build, package, and distribute your application to the Apple App Store.
This book will teach you how to go about building simple applications from scratch, you will master how to download and install the Xcode 4 Development Tools, get to know the development environment and how to build great user interfaces (using Interface Builder), learn about the different iOS frameworks, learn how to implement video and audio playback, learn how to sense motion using the Accelerometer and Gyroscope, and how to improve the reliability and performance of your applications.
After reading Xcode 4 iOS Development Beginner's Guide, you will be able to write your own applications for the iPhone with supreme efficiency. There are a lot of examples and images provided to get you up to speed quickly.
Using this book's easy to follow step-by-step approach you will harness Xcode 4's firepower to create some stunning applications for your iPhone
ApproachThis step-by-step book guides you through the process of creating awesome iOS apps using Xcode 4. As a beginner's guide, it focuses on getting you through all the major learning points in a smooth, logical order while showing you how to avoid some common pitfalls.
Who this book is forIf you want to learn how to build iOS applications that compete with the rest and make your mark within the iOS industry, this book is for you. You should have some basic programming experience with Objective-C, and a good understanding of OOP, as well as some knowledge of database design. No knowledge of Xcode 4 is required.
Sobre o autor
Autores relacionados
Relacionado a Xcode 4 iOS Development Beginner's Guide
Categorias relacionadas
Amostra do Livro
Xcode 4 iOS Development Beginner's Guide - Steven F. Daniel
Table of Contents
Xcode 4 iOS Development
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action – heading
What just happened?
Pop quiz – heading
Have a go hero – heading
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introducing Xcode 4 Tools for iOS Development
Development using the Xcode tools
iPhone SDK core components
Inside Xcode, Cocoa, and Objective-C
The iPhone Simulator
Layers of the iOS architecture
The Core OS layer
The Core Services layer
The Media layer
The Cocoa-Touch layer
Understanding Cocoa, the language of the Mac
What are Design Patterns?
What is the difference between Cocoa and Cocoa-Touch?
The Model-View-Controller
What is Object-Oriented Programming?
What is Data Hiding?
What is Objective-C?
Directives
Objective-C classes
The @interface directive
The @implementation directive
Class instantiation
Class access privileges
Introducing the Xcode Developer set of tools
Introducing the core tools
The Welcome to Xcode screen
The Xcode Integrated Development Environment
Features of the iPhone Simulator
Companion tools and features
Instruments
iPhone OS4 SDK new features
Summary
2. Introducing the Xcode 4 Workspace
Downloading and installing the iOS SDK
Removing the Xcode Developer Tools
Getting to know the Xcode Development Environment
One environment to bind them all
Working within a single-development environment
Creating a new project
Migrating older projects into the new environment
Writing a simple iPhone application
Time for action – creating your first iPhone application
What just happened
Working with the new Xcode Assistant
Introducing the Xcode 4 Workspace Environment
Application ToolBar
Application Status Bar/Activity Window
WorkSpace Settings
Introducing the Unified Navigation UI
Listing files in a project
Sorted Symbols
Central Search Interface
Issues Tracking
Using Static Analysis to find potential problems
Debugging data with Compressionable Stack Traces
Active/inactive breakpoints
Collection of Logs
Jump Bar
Using Code Assistants
Introducing the new and improved LLVM Compiler 2.0
Version Editor
File Templates Library
Code Snippets Library
Object Library
Media Library
Resetting Xcode's Development Environment Settings
Xcode Workspace Preferences
General
Behaviors
Fonts & Colors
Text Editing
Key Bindings
Documentation
Locations
Source Trees
Distributed Builds
Summary
3. Working with the Interface Builder
Getting to know the Interface Builder environment
Adding Controls to your user interface
Time for action – creating the HelloXcode4_GUI application
What just happened?
Application structure of our HelloXcode4 example application
Main.m
HelloXcode4_GUIAppDelegate.h
HelloXcode4_GUIAppDelegate.m
The MainWindow.xib file
The Core Application Architecture layer
The application life cycle
Time for action – adding object controls to our View
What just happened?
Understanding Rotatable Interfaces
Time for Action – enabling Interface Rotation
What just happened?
Relocating controls within the view on Rotation
Making our Components work together
Time for action – binding Control Objects
What just happened?
Time for action – repositioning the Controls
What just happened?
Enhancing our iPhone application
Time for action – hiding the keyboard
What just happened?
Have a go hero – enhancing the HelloXcode4 example
Introducing Document-based applications
Time for action – creating a Document-based application
What just happened?
File saving and loading
Time for action – implementing file saving and loading
What just happened?
Pop quiz – Actions and Rotatable Interfaces
Summary
4. Working with the Xcode Frameworks
Introducing the Frameworks
Using Frameworks and APIs in iPhone development
Core Data Frameworks
Building a simple database application
Time for action – creating the Core Data application
What just happened?
AV Foundation Frameworks
Playing an audio File
Creating an application to play an audio file
Time for action – creating the MusicPlayer application
What just happened?
Playing a movie using Media Player
Time for action – creating the MoviePlayer application
What just happened?
Core Location Framework
Time for action – making your application location aware
What just happened?
Map Kit Framework—new and improved
Time for action – creating a simple geographical application
What just happened?
New Framework APIs
Have a go hero – modifying the Core Data example
Pop quiz – Core Data / Media Playback and Core Location
Summary
5. Designing Application Interfaces using MVC
Developing iOS applications using MVC design
Reusing tested (or standard) solutions: Design patterns
Understanding the Model-View-Controller design pattern
Implementing MVC using Xcode and Interface Builder
Time for action – building a Pizza order application
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Implementing views
Implementing view controllers
Time for action – declaring input field as a property of View Controller
What just happened?
Creating a view-based application template
Time for Action – creating the FavoriteColor application
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Implementing Table Views
Time for action – creating a Table view application
What just happened?
Grouping row items into sections
Time for action – grouping row items in our TableViewExample application
What just happened?
Understanding Navigation-based applications
Using Switches, Sliders, Segmented Controls, and Web Views
Time for action – creating the SwitchesSlidersSegments project
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Creating an application to scroll through large content
Time for action – creating the ScrollingViews project
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Understanding Pickers
Date Pickers
Time for action – creating the Date Picker project
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Custom Pickers
Time for Action – creating the Custom Picker project
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Handling basic user input and output
Button Controls
Text Fields
Text Views
Labels
Using Text Fields, Text Views, and Buttons
Time for action – creating application with Text fields, Text Views, and Buttons
What just happened?
Time for action – binding our Controls using Outlets and Actions
What just happened?
Have a go hero – modifying the Table View example
Pop quiz – Table Views / repositioning Controls
Summary
6. Displaying Notification Messages
Exploring the notification methods
Generating alerts
Time for action – creating the GetUsersAttention application
What just happened?
Time for action – adding the AudioToolbox Framework to our application
What just happened?
Pop quiz – Frameworks
Building our user interface
Time for action – adding controls to our View
What just happened?
Creating events
Time for action – implementing the Show Activity Indicator method
What just happened?
Have a go hero – adding a second activity indicator
Pop quiz – Activity Indicators
Time for action – implementing the Display Alert Dialog method
What just happened?
Responding to Alert Dialog Button presses
Have a go hero – adding additional buttons and creating the events
Pop quiz – Alert Dialogs and Button Indexes
Using Action Sheets to associate with a view
Time for action – implementing the Display Action Sheet method
What just happened?
Responding to Action Sheet Button presses
Customizing an Action Sheet
Time for action – handling alerts via sounds and vibrations
What just happened?
Have a go hero – adding Action Sheet items / changing appearance
Pop quiz – sounds and vibrations
Summary
7. Exploring the MultiTouch Interface
Introducing the MultiTouch architecture
Detecting taps
Time for action – creating the TapExample project
What just happened?
Time for action – binding our Controls
What just happened?
Have a go hero – modify the program to change background
Pop quiz – tap counts
Detecting swipes
Time for action – creating the SwipeExample project
What just happened?
Have a go hero – adjust the delayFactor and change the background
Pop quiz – tracking and identifying swipes
Detecting pinches
Time for action – creating the PinchExample project
What just happened?
Have a go hero – handling more than two fingers
Pop quiz – pinches and transformations
Detecting shakes
Time for action – creating the ShakeExample project
What just happened
Time for action – implementing the motionBegan, motionEnded, and motionCancelled methods
What just happened?
Have a go hero – modifying the ShakeExample application
Pop quiz – motion events
Exploring the Accelerometer/Gyroscope
Understanding the Core Motion Framework
Sensing orientation
Time for action – creating the OrientationExample project
What just happened?
Have a go hero – modify the OrientationExample application
Pop quiz – sensing orientation
Detecting device tilting
Time for action – creating the AccelGyroExample project
What just happened?
Summary
8. Debugging Xcode Projects
Introducing the new and improved Debugger
Debugger toolbar
Stack trace panel
Disassembly view
Code Editor window
Console output window
Creating a new debugging project
Time for action – creating the DebuggingExample project
What just happened?
Running and debugging the project
Handling errors
Runtime errors
Syntax errors
Logic errors
Using Fix-it to correct code as you type
Time for action – setting up the LLVM compiler
What just happened?
Debugging with breakpoints
Using NSLog to track changing properties
Exploring the new Debugger
Debugging features in the Code Editor
The Activity Viewer/Progress window
Defining a scheme for project builds using the Scheme Editor
Time for action – using the Scheme Editor to define a Scheme
What just happened?
Viewing the Static Analysis results
Time for action – running the Static Analyzer
What just happened?
Time for action – configuring your project to perform automatic Static Analysis
What just happened?
Time for action – Detecting a memory leak
What just happened?
Time for action – detecting an instance of an uninitialized variable
What just happened?
Viewing the Issues Navigator
Viewing the Program Build log
Understanding and using code completion
Time for action – working with code completion
What just happened?
Time for action – stopping Xcode from alerting you to problems
What just happened?
Navigating through threads and stacks in the Debugger
Have a go hero – Static Analyzer and debugging features
Pop quiz – all about debugging projects
Summary
9. Source Code Management with the Version Editor
Introducing the new Version Editor
Introducing Subversion
Installing a local Subversion server
Creating a repository
Time for action – setting up a local Subversion repository
What just happened?
Configuring the repository in Xcode
Time for action – configuring the Subversion repository
What just happened?
Adding items to an existing repository
Time for action – adding our TapExample project to the repository
What just happened?
Getting a working copy of the project out of the repository
Time for action – checking out the project from the repository
What just happened?
Xcode source-control features and file statuses
Comparing different versions of a file side-by-side
Using Timeline to select and compare revisions
Using Track Blame to check past check-ins
Using Log Mode to list all revisions chronologically
Using the Repository Organizer to keep track of your files
Using Git to manage multiple projects
Time for action – creating a new Xcode project using Git
What just happened?
Time for action – assigning address book identities within the organizer
What just happened?
Have a go hero – adding a project to a Subversion repository
Pop quiz – Subversion / Version Editor
Summary
10. Making your Applications Run Smoothly
Introducing Instruments
Tracking down and fixing memory leaks
Time for action – creating the InstrumentsExample project
What just happened?
Time for action – running and Profiling the project
What just happened?
Adding and configuring Instruments
Using the Instruments Library
Locating an Instrument within the Library
Adding and removing Instruments
Configuring an Instrument
Other components of the Instruments family explained
New Instruments in Xcode 4
Automated Testing
Performance and Power Analysis
Time Profiler
Energy Diagnosis
Tracking iPhone graphics performance using OpenGL ES Driver
Have a go hero – adding Instruments to your project
Pop quiz – playing with Instruments
Summary
11. Distributing your Application
Build configurations – debug to release
The iPhone Developer Program
Setting up your iPhone development team
Time for action – setting up the team
What just happened?
Getting an iOS development certificate
Time for action – generating a Certificate Request
What just happened?
Time for action – getting the certificate
What just happened?
Registering devices for testing
Time for action – registering devices
What just happened?
Creating application IDs
Time for action – creating the application ID
What just happened?
Creating a Provisioning Profile
Time for action – creating the profile
What just happened?
Using the Provisional Profile to install an App on an iOS device
Time for action – creating and deploying the app to an iOS device
What just happened?
Getting a Distribution Certificate for your app
Time for action – getting the Distribution Certificate
What just happened?
Archiving and submitting Apps using Xcode 4
iOS Human Interface Guidelines
Testing your application
Preparing your App for submission through iTunes Connect
Avoiding rejection of your App
Pricing your app
Adding your App to iTunes Connect
Time for action – uploading the application icon and screenshot images
What just happened?
Using iTunes Connect to manage your Apps
Marketing and promoting your app
iOS Developer Documentation
Have a go hero – creating App IDs and submitting your App
Pop quiz – distribution of your App
Summary
Pop Quiz Answers
Chapter 3
Actions and Rotatable Interfaces
Chapter 4
Core Data/Media Playback and Core Location
Chapter 5
Table Views/repositioning Controls
Chapter 6
Frameworks
Activity Indicators
Alert Dialogs and Button Indexes
Sounds and vibrations
Chapter 7
Tap counts
Tracking and identifying swipes
Pinches and transformations
Motion events
Sensing orientation
Chapter 8
All about debugging projects
Chapter 9
Subversion/Version Editor
Chapter 10
Playing with Instruments
Chapter 11
Distribution of your App
Index
Xcode 4 iOS Development
Beginner's Guide
Xcode 4 iOS Development
Beginner's Guide
Copyright © 2011 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2011
Production Reference: 1160811
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-849691-30-7
www.packtpub.com
Cover Image by Tom Glasspool (<t.glasspool@gmail.com>)
Credits
Author
Steven F. Daniel
Reviewers
Cory Bohon
Mark Hazlett
Acquisition Editor
Steven Wilding
Development Editor
Chris Rodrigues
Technical Editor
Dayan Hyames
Indexer
Monica Ajmera Mehta
Project Coordinator
Leena Purkait
Proofreader
Mario Cecere
Graphics
Valentina D'silva
Geetanjali Sawant
Production Coordinator
Shantanu Zagade
Cover Work
Shantanu Zagade
About the Author
Steven F. Daniel is originally from London, England, but lives in Australia. He is an experienced software developer with more than 13 years of experience in developing desktop and web-based applications for a number of companies, in sectors including insurance, banking and finance, oil and gas, and local government. Xcode 4 iOS Development Beginner's Guide is his first book.
Steven is always interested in emerging technologies, and is a member of the SQL Server Special Interest Group (SQLSIG) and the Java Community. He is the owner and founder of GenieSoft Studios (http://www.geniesoftstudios.com/), a software development company based in Melbourne, Victoria, that currently develops games and business applications for the iOS, Android, and Windows platforms.
Steven was the co-founder and Chief Technology Officer (CTO) of SoftMpire Pty Ltd., a company that focused primarily on developing business applications for the iOS and Android platforms. You can check out his blog at http://geniesoftstudios.com/blog/, or follow him on Twitter at http://twitter.com/GenieSoftStudio.
This book is dedicated to:
Chan Ban Guan, for the patience, support, encouragement, and understanding all of those times when I couldn't go out as I needed to write in order to meet the deadlines.
My family for their continued love and support, and for always believing in me.
Chan Jie Hou, may God watch over you and keep you safe.
This book would not have been possible without your love and understanding.
Thank you from the bottom of my heart.
Acknowledgement
No book is the product of just the author—he just happens to be the one with his name on the cover.
A number of people contributed to the success of this book, and it would take more space than I have to thank each one individually.
A special shout out goes to Steven Wilding, my Acquisition Editor, who is the reason that this book exists. Thank you, Steven, for believing in me, and for being a wonderful guide through this process. I would also like to thank Leena Purkait for ensuring that I stayed on track and got my chapters in on time.
Thank you also to the entire Packt Publishing team for working so diligently to help bring out a high quality product.
To the engineers at Apple for creating the iPhone, and providing developers with the tools to create fun and sophisticated applications, you guys rock.
Finally, I'd like to thank all of my friends for their support, understanding, and encouragement during the writing process. It is a privilege to know each one of you.
About the Reviewers
Cory Bohon is a professional blogger and contributor to MacLife magazine, and a Mac and iPhone developer, experienced in Java, C/C++, Objective-C, and PHP. He is currently attending the University of South Carolina Upstate, where his current research interests include accessible user interface design and mobile application development.
Mark Hazlett is a mobile and web applications developer located in Calgary, Alberta, Canada. He has a true passion for mobile application development, especially on developing for the iPhone. In his spare time, Mark likes to read about new technologies, learn new languages, and start new projects.
He is constantly learning new technologies and applying them to as many personal projects as he can find time for. All in all, he is extremely passionate about usability and user interaction and tries to apply best practices to all of his projects.
I would like to thank my family: Tom, Jan, and Ryan for always being extremely supportive in my many endeavors. I would also like to thank Packt Publishing for giving me the opportunity to review this book.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
The iPhone is one of the hottest mobile devices on the planet. Whether you are just starting out with iPhone Development or already have some knowledge in this area, you will benefit from what this book covers. Using this book's straightforward, step-by-step approach, you will go from Xcode 4 apprentice to Xcode 4 Jedi master in no time.
Xcode 4 iOS Development Beginner's Guide will help you learn to build simple, yet powerful applications for the iPhone from the ground up. You will master the Xcode 4 tools and skills needed to create applications that are simple yet, like Yoda, punch far above their weight.
In this book, I have tried my level best to keep the code simple and easy to understand. I have provided step-by-step instructions with screenshots at each step to make it easier. You will soon be mastering the technology and skills needed to create some stunning applications. Feel free to contact me at <geniesoftstudios@gmail.com> for any queries. Any suggestions for improving this book will be highly appreciated.
What this book covers
Chapter 1, Introducing Xcode 4 Tools for iOS Development, introduces the developer to the Xcode developer set of tools, the new features of the iOS 4 SDK and the iOS Architecture Layers and their components. It also includes a discussion of Cocoa, Cocoa-Touch, and the basics of object-oriented programming using Objective-C.
Chapter 2, Introducing the Xcode 4 Workspace, discusses how to download and install the Xcode 4 and iOS4 SDK and introduces you to the Xcode 4 development environment and the different types of libraries that are part of the workspace to create a simple iPhone application.
Chapter 3, Working with the Interface Builder, introduces the developer to the Interface Builder application and explains the iOS application life cycle when an application is run. It also covers how to implement file saving and loading of Document-based applications, as well as how to reposition the controls within the view when the device is rotated.
Chapter 4, Working with the Xcode Frameworks, introduces the developer to the different types of Xcode frameworks for audio and video playback, and Core Location services for determining geographical locations. It also covers how to build a simple database application using the Core Data Framework.
Chapter 5, Designing Application Interfaces using MVC, introduces the developer to the various layers of MVC and design patterns and the importance of implementing these in iOS applications. It also covers how to interact with the user, with lots of code examples.
Chapter 6, Displaying Notification Messages, explores the different notification methods through which we can communicate with the user to grab their attention, by using alerts, activity indicators, sounds, and vibrations, with lots of code examples.
Chapter 7, Exploring the MultiTouch Interface, shows you how easy it is to incorporate both single-touch and multi-touch support into your applications and include support for tapping, pinching, and swipes. You will also learn about the built-in shake gesture and how to go about responding to the shake motions, before finally learning about the accelerometer and the new gyroscope features, as well as how to control your application UI when the orientation changes.
Chapter 8, Debugging Xcode Projects, shows us how to go about debugging our projects, through the use of the various debugging tools that Xcode provides. We are also introduced to the new debugging features of the editor, and how to use the Static Analyzer tool to determine potential memory leaks, dead code, and unreachable code, as well as using the new Fix-it! feature to correct syntax errors as we type.
Chapter 9, Source Code Management with the Version Editor, focuses on the new features of the Xcode Version Editor that has been integrated directly within the Xcode 4 IDE and provides you with an easy way to manage your source code. By using this tool, you are able to travel back through your revisions to compare previous changes made throughout the life cycle of the file.
Chapter 10, Making your Applications Run Smoothly, focuses on how we can effectively use Instruments within our applications to track down memory leaks and bottlenecks within our applications that could potentially cause our application to crash on the user's iOS device. We take a look into each of the different types of built-in instruments, which come as part of the Instruments application and how we can use the Leaks instrument to help track down and determine where memory leaks are happening within our code. We also look at how we can configure instruments to display data differently within the trace document that is being reported.
Chapter 11, Distributing your Application, provides you with the necessary steps that are required to submit your applications to the App Store. It explains how to register devices for testing and how to create and obtain provisioning profiles for development and distribution.
What you need for this book
This book assumes that you have an Intel-based Macintosh running Snow Leopard (Mac OS X 10.6.2 or later). You can use Leopard, but I would highly recommend upgrading to Snow Leopard, as there are many new features in Xcode that are available only on Snow Leopard. We will be using Xcode, an integrated development environment used for creating applications for the iPad, iPhone, and other Mac applications. You can download the latest version of Xcode at the following link: http://developer.apple.com/xcode/.
Who this book is for
If you ever wanted to learn how to build iOS applications and make your mark within the iOS industry and have your applications compete with the rest, this book is for you. You should have some basic programming experience with Objective-C, and a good understanding of OOP, as well as some knowledge of database design.
Conventions
In this book, you will find several headings appearing frequently.
To give clear instructions of how to complete a procedure or task, we use:
Time for action – heading
Action 1
Action 2
Action 3
Instructions often need some extra explanation so that they make sense, so they are followed with:
What just happened?
This heading explains the working of tasks or instructions that you have just completed.
You will also find some other learning aids in the book, including:
Pop quiz – heading
These are short multiple choice questions intended to help you test your own understanding.
Have a go hero – heading
These set practical challenges and give you ideas for experimenting with what you have learned.
You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: If you observe the content of the MyClass.h file, you will notice that at the top of the file is a #import statement.
A block of code is set as follows:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window makeKeyAndVisible];
return YES;
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
Any command-line input or output is written as follows:
defaults delete com.apple.Xcode
rm –rf ~/Library/Application\ Support/Xcode
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Click on the Next button to proceed to the next step of the wizard.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of the book, and we will do our best to address it.
Chapter 1. Introducing Xcode 4 Tools for iOS Development
Welcome to the exciting world of iPhone Programming using Xcode 4. Since the release of the original iPhone back in 2007, it has taken the world by storm and opened up a whole new world to developers. This unique device comprises a multi-touch interface, video and audio playback capabilities, stunning graphics and sound, map and localization services, always-on internet and Wi-Fi services, and a whole range of built-in sensors which can be used to create everything from stunning games to business applications.
You are probably eager to get stuck right in and start creating that next big thing to hit the AppStore, and start to join those other tens of thousands