Beginning iOS 5 Development

David Mark, Jack Nutting, Jeff LaMarche

Mentioned 3

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

More on

Mentioned in questions and answers.

Are there any recommended books for developing iPad apps using iOS 5 specifically covering features like storyboards and segues with different examples.

Mainly working on the iPad 2 here but any good iOS 5 book would be welcome.

Many Thanks Geoff

I found Beginning iPhone 4 Development: Exploring the iOS SDK by Mark, Nutting and LaMarche useful, and it now has an iOS 5 edition: Beginning iOS 5 Development: Exploring the iOS SDK (though I haven't read that version). (There's also a followup text, More iOS 5 Development: Further Explorations of the iOS SDK.)

I have an iOS app in the app store. I'm working on some new features for it. Some code i've hand crafted, other bits of pieced together from answers on this wonderful site, however I feel like my code is a bit ugly, and could be improved. When I see something below this, I don't full understand how it is used automatically, and how it implies a loop exactly. So i'm wondering what would be some good reading material to learn more about objective-c before maybe working on my app more.

I've been surfing some articles on the ios dev center website, but if you guys can suggest some specifics to look at, i'd be grateful. I do have an understanding of heap & stack memory management from when I did C++, but I have to admit im not as solid on how objective-c does it.

- (void)tableView:(UITableView *)aTableView 
forRowAtIndexPath:(NSIndexPath *)indexPath { ... }

For a thorough general understanding of iOS & ObjC, I'd suggest a book or two:

And/or following the Stanford iOS course on iTunes U. There are a few good blogs for tutorials & explanations out there, too: Ray Wenderlich's and Cocoa is my Girlfriend are the first to come to mind.

For something more specific to table views or other subsystems, the Programming Guides in Apple's developer documentation aren't bad.

What would be the best way in accomplishing this? Let's say I have a method (not defined) that would allow a line with a fixed size and color to be drawn on the screen. This line would need to then accept rotate gestures and panning gestures in order to move around the screen. It won't resize, it only needs to rotate and translate.

What is the best way of going about this? Should lines be subviews or sublayers to parent view? What is the method for drawing a line in ios? How to handle multiple lines on screen? I just want someone to lead me down the right path in the ios graphics jungle.

Firstly, you need to consider how complex the whole drawing is. From your description it sounds like the task is relatively simple. If that is the case, then Core Graphics would be the way to go. If the drawing is significantly more complex, you should look at OpenGL ES and GLKit, though using OGL involves a fair bit more work

Assuming Core Graphics, I'd store the centre point, angle and length of the line, and change the angle and size using the gesture recognizers, and calculate the points to draw using basic trig. Loop over the points to draw in the view -drawRect method and draw each one with the appropriate CG functions - call [view setNeedsDisplay] or [view setNeedsDisplayInRect:areaToRedraw]to trigger the redraws. (The second method only redraws the part of the view you specify, and can be used to improved performance).

The first of a series of tutorials on Core Graphics is here.- the part on 'drawing lines' will be most relevant. I haven't done this one (I used the old edition of this book), but I've followed a lot of others from this site and found them very helpful

As a side note you'll probably need a way to focus on a particular line if you have more than one on the screen- an easy way would be to find the line centre point closest to the point the user touched.