Beginning iOS 5 Development

Exploring the iOS SDK

By David Mark , Jack Nutting , Jeff LaMarche

Everything you need to know to develop your own best-selling iPhone 4S and iPad 2 apps based on the new iOS 5 SDK with the latest Xcode, plus best practices for optimizing your code and delivering great user experiences.

Full Description

  • ISBN13: 978-1-4302-3605-4
  • 752 Pages
  • User Level: Beginner to Intermediate
  • Publication Date: December 17, 2011
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $39.99
  • eBook Price: $27.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

The team that brought you the bestselling Beginning iPhone 4 Development is back again for Beginning iOS 5 Development, bringing this definitive guide up-to-date with Apple's latest and greatest iOS SDK, as well as with the latest version of Xcode.

There's coverage of brand new technologies, with chapters on storyboards and iCloud, for example, as well as significant updates to existing chapters to bring them in line with all the changes that came with the iOS 5 SDK. You'll have everything you need to create your very own apps for the latest iOS devices, including the iPhone 4S, iPad 2, and the latest iPod touch. Every single sample program in the book has been rebuilt from scratch using Xcode 4.2 and the latest iOS 5-specific project templates and designed to take advantage of the latest Xcode features.

Assuming only a minimal working knowledge of Objective-C, and written in a friendly, easy-to-follow style, Beginning iOS 5 Development offers a complete soup-to-nuts course in iPhone, iPad, and iPod touch programming. The book starts with the basics, walking through the process of downloading and installing Xcode and the iOS 5 SDK, and then guides you though the creation of your first simple application.

From there, you’ll learn how to integrate all the interface elements Apple touch users have come to know and love, such as buttons, switches, pickers, toolbars, and sliders. You’ll master a variety of design patterns, from the simplest single view to complex hierarchical drill-downs. The confusing art of table building will be demystified, and you’ll learn how to save your data using the iPhone file system. You’ll also learn how to save and retrieve your data using a variety of persistence techniques, including Core Data and SQLite. And there’s much more! You’ll learn to draw using Quartz 2D and OpenGL ES, add multitouch gestural support (pinches and swipes) to your applications, and work with the camera, photo library, accelerometer, and built-in GPS. You’ll discover the fine points of application preferences and learn how to localize your apps for multiple languages.

  • The iOS 5 update to the bestselling and most recommended book for Cocoa touch developers
  • Packed full of tricks, techniques, and enthusiasm for the new SDK from a developer perspective
  • Written in an accessible, easy-to-follow style

What you’ll learn

  • Everything you need to know to develop your own bestselling iPhone and iPad apps
  • Best practices for optimizing your code and delivering great user experiences
  • How to create “universal” apps for both the iPhone and iPad
  • What is data persistence and why is it important
  • Get started with building cool, crisp User Interfaces
  • What and how to use Table Views
  • How to do graphics with Quartz and OpenGL ES
  • What geo app development features the new iOS 5 brings to the iPhone 4S
  • How to get your app in iCloud
  • And much much more...

Who this book is for

Everyone who wants to start developing for iPhone, iPod touch, and iPad!

For the latest sourcecode, please head to www.iphonedevbook.com.

Table of Contents

Table of Contents

  1. Welcome to the Jungle
  2. Appeasing the Tiki Gods
  3. Handling Basic Interaction
  4. More User Interface Fun
  5. Autorotation and Autosizing
  6. Multiview Applications
  7. Tab Bars and Pickers
  8. Introduction to Table Views
  9. Navigation Controllers and Table Views
  10. Storyboards
  11. iPad Considerations
  12. Application Settings and User Defaults
  13. Basic Data Persistence
  14. Get Your App in the iCloud
  15. Grand Central Dispatch, Background Processing, and You
  16. Drawing with Quartz and OpenGL
  17. Taps, Touches, and Gestures
  18. Where Am I? Finding Your Way with Core Location
  19. Whee! Gyro and Accelerometer!
  20. iPhone Camera and Photo Library
  21. Application Localization
  22. Where to Next?
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page chapter 7, page 13:
When I exec this:
"Open the identity inspector, and then select File’s Owner in the dock. The identity inspector will show NSObject in the Custom Class’s Class field. We need to change NSObject to BIDAppDelegate, marking the app delegate as the File’s Owner, which will allow us to connect the rootController outlet to the new controller. Go ahead and type BIDAppDelegate or select it from the popup."

the following warning is displayed:

Defines Presentation Context is not available prior to Xcode 4.2.


On page 46:
Some of the keyboard shortcuts seem to confuse the option and the shift key. New Project is Shift-Cmd-N and Open Quickly is Shift-Cmd-O.

On page 50:
@property (nonatomic, retain)... is pre-ARC. It should be replaced by @property (strong, nonatomic)...

On page 72:

Regarding passive controls, it says: "text fields and image controls are often used in this manner."

Shouldn't that be "labels" and not text fields. I'm pretty sure text fields are specifically used FOR user interaction, not passive controls.

On page 77:

2nd last sentence on the page. Editor > Size to Fit Content should read Edit > Size to Fit Content.

On page 78:

Line #5: The alignment menu should be:
Editor -> Align -> Horizontal Center in Container


On page 93:

backgroundTap method does not hide the keyboard as expected.

to achieve the desired outcome, the code:
[nameField resignFirstResonder];
[numberField resignFirstResonder];

should be replaced with:
[self.view endEditing:YES];

On page 133:

Chapter 6:

Perhaps due to recent XCode changes, you must override loadView in each BID*ViewController.m, or at least call [super loadView] from within the loadView method in each of the hand-rolled controllers.

- (void)loadView
{
// If you create your views manually, you MUST override this method and use it to create your views.
// If you use Interface Builder to create your views, then you must NOT override this method.
[super loadView]; // <==== ADD THIS
}

On page 144:

Chapter 6, Figure 6-10.

My version of Xcode 4.3 (4E109) does not provide UIViewController subclass as a template to choose from. I manually copied the relevant files from the sample code provided from the website to create the ViewController subclass.

On page 155:

The code after "We then check to see whether yellowViewController is nil" is wrong.

It should be:

if (self.yellowViewController == nil) {

On page 240:

@implementation ViewController

changed to:

@implementation BIDViewController

All Error messages resolved.

On page 275:

The following code:

cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier: sectionsTableIdentifier] autorelease];

Information for iOS 5 Documentation:

initWithFrame:reuseIdentifier:
Initializes and returns a table cell object. (Deprecated in iOS 3.0. Use initWithStyle:reuseIdentifier: instead.)


On page 277:

Here is a your code:

[self.keys removeObjectsInArray:sectionsToRemove]; [sectionsToRemove release];
[table reloadData];

when we use the ARC "release" method, the following line is not needed:

[sectionsToRemove release];

On page 299:
"Error" (only cosmetic but is fixed in all other views in the app) in source code - the row is not deselected in the disclosure button table view. Insert

[tableView deselectRowAtIndexPath:indexPath animated:YES];

below [alert show];

On page 349:

Under "But There's One More Thing" is the line "We can do this by deleting a single line of code from BIDPresidentDetailController.m. In the tableView:cellForRowAtIndexPath: method, delete the following line of code:"

After this line is the original set of code for this method, with no changes. There is no indication of what line needs to be deleted.

On page 558:

The line "if (indexNumber = [[NSUserDefaults standardUserDefaults]..."

should be: "if (indexNumber ==..."