Introduction

The easy part of software development is knowing how to write code in the programming language at hand. The tougher part is mastering the programming interfaces of the platform and getting to the level where you can effectively turn ideas into working features with real values. iOS 7, although extremely powerful and easy to use, is no exception to this. Objective-C, considered by many to be a somewhat “funky” programming language, is a language you can get your head around quickly and even learn to appreciate. However, you’re likely to spend a lot of time learning the various APIs and frameworks.

We believe the best way to acquire the necessary knowledge and reach a plateau of high productivity is through hands-on experience. We think the best way to learn is to follow step-by-step procedures, creating small projects in which you can test and tweak the features and get a feel for them before you implement them in your real projects.

With this idea in mind, we created iOS 7 Development Recipes. This book contains over 600 pages of sample code accompanied by instructions about how to create small test apps that allow you to run the code on your iOS 7 device or in the iOS simulator.

We have tried to cover as many topics as possible based on the features of iOS 7. We hope this book provides the fundamentals you need to start converting your great ideas into fantastic apps.

Who This Book Is For

When you read this book, it will help if you have a basic knowledge of Objective-C, have taken your first steps in Xcode, and have written a couple of Hello World apps. If you haven’t, don’t worry; simply pay extra attention to the first eight recipes of Chapter 1. They should provide most of the basics you will need in order to follow along with the recipes in the rest of the book.

How This Book Is Structured

For the most part, the example-based chapters of this book do not build on one another; that is, you do not have to read the chapters sequentially. You should be able to read the chapters and build your apps in any order you want, depending on your specific interests. Whenever we do build on an example from a different chapter, we will let you know.

However, we recommend that you at least skim Chapter 1, “Application Recipes,” then Chapter 2, “Storyboard Recipes,” and finally Chapter 3, “Layout Recipes,” before moving on.

The first chapter contains recipes for common tasks, such as creating outlets and actions, which are referenced throughout the book and should be fully understood before you move ahead.

The second chapter covers storyboards. Storyboards are an alternative way of building user interfaces. Storyboards show both the individual screens (single view controllers) and the connections (segues) between them. Before the introduction of storyboards in iOS 5, .xib files were typically used to build the interface. The .xib files were individual scenes; that is, one .xib file per scene. The connections between .xib files were handled in code. While you still have the ability to use .xib files, it is clear that Apple is pushing developers more and more to use storyboards instead.

The third chapter provides basic knowledge of the layout tools for iOS 7. Reading that chapter might be helpful when you create the user interfaces of the recipes later, especially if you want your scenes to look good on multiple devices.

This book uses a mix of programmatic interface building, storyboards, and .xib files. For the most part, you will start every application with a single view application template for the iPhone that will include a storyboard. We will instruct you otherwise if this is not the case.

Throughout this book, we assume you are developing in the latest versions of iOS and Xcode, which at the time of writing are iOS 7.0 and Xcode 5.0.

Many of the recipes in this book cannot be fully tested on the iOS simulator, and as such will require both an iOS device and a provisioning profile, which you can acquire when you subscribe to the iOS Developer Program. At the time of this writing, the developer program costs $99.00 USD. We’ve pointed out each recipe that cannot be tested in the iOS simulator.

Note   Since the introduction of iPhone 5, there are two screen sizes to account for: the 3.5" screen and the 4" screen. The width in both screens is the same, but the 4" screen is taller. Most of the interfaces in this book are laid out to look good on a 3.5" screen and will have unused space if run on a 4" screen. Feel free to modify the interface to better fit a 4" screen if that is what you want. Chapter 3 discusses Auto Layout, which will give you the tools to make an interface look good on either size screen.

What’s New in This Edition

By now you undoubtedly have seen the fresh look of iOS 7. Because of the new software, we’ve made numerous changes to the images and code we provided in the previous edition of this book, iOS 6 Recipes: A Problem-Solution Approach. While we couldn’t address everything iOS 7 has to offer in this new edition, we tried to add some topics we found very useful to the average developer.

Because iOS 7 is a major overhaul in design, all the images and figures have been updated to reflect the new design. Apple has made numerous minor changes to existing APIs for iOS 7. We updated the code in this book to reflect those changes.

Due to Apple’s added emphasis on storyboards, we have changed the examples in this book to take advantage of storyboards rather than .xib files. Previous editions of this book were largely based on .xib files. In addition, we created a new chapter for storyboards (Chapter 2), which now includes instructions for creating tab view controllers.

Auto Layout has changed with iOS 7, so we have updated Chapter 3 to reflect these changes. Auto Layout constraints no longer exist for the developer. This greatly increases developer freedom and flexibility.

Apple added nice features to the Map Kit framework, which allow you to get directions from Apple as well as take full advantage of 3-D map support. We have included recipes that show you how to use both of these new features in Chapter 7.

iOS 7 gives us the ability to detect and read QR codes with the camera natively. We added a new recipe to Chapter 9, "Camera Recipes," that shows how to read QR codes.

We also added Chapter 12, which focuses on Core Graphics. While the previous edition touched on Core Graphics, we have expanded the content in its own chapter.

The most exciting contribution to this new edition is a new chapter on animation (Chapter 13). This chapter introduces some UIView animation basics and then moves on to the new UIKit Dynamics framework. This framework allows for realistic, physics-inspired animation.

Downloading the Code

The code for the examples included in this book is available on the Apress web site at www.apress.com. You can find a link on the book’s information page under the Source Code/Downloads tab. This tab is located under the Related Titles section of the page.

Contacting the Author

If you have any questions or comments regarding this book, I would be happy to hear them. Contact me at [email protected] and include “iOS 7 Recipes” in the subject line, or write a comment on my blog at http://www.NSCookbook.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset