Beginning iPhone Development: Exploring the iOS SDK
Jack Nutting, Kim Topley, Jeff LaMarche
Format: PDF / Kindle (mobi) / ePub
The team that brought you the bestselling Beginning iPhone Development, the book that taught the world to program on the iPhone, is back again, bringing this definitive guide up-to-date with Apple's latest and greatest new iOS 8 and its SDK, as well as with the latest version of Xcode (6.1).
You'll have everything you need to create your very own apps for the latest iOS devices. Every single sample app in the book has been rebuilt from scratch using Xcode 6.1 and the latest 64-bit iOS 8-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 iPhone 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 6.1 and the iOS 8 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 iOS 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!
What you’ll learn
- Everything you need to know to develop your own bestselling iPhone and iPad apps
- Filled with examples
- Best practices for optimizing your code and delivering great user experiences
- What data persistence is, and why it’s important
- Get started with building cool, crisp user interfaces
- What and how to use Table Views
- How to draw to the screen using Core Graphics
- What geo app development features the new iOS brings to the iPhone
- How to get your app to work with iCloud and more
Who this book is for
This book is for aspiring iPhone app developers, new to the iOS SDK. Some prior experience with Objective-C is recommended.
Table of Contents
1. Welcome to the Jungle
2. Appeasing the Tiki Gods
3. Handling Basic Interaction
4. More User Interface Fun
5. Rotation and Adaptive Layout
6. Multiview Applications
7. Tab Bars and Pickers
8. Introduction to Table Views
9. Navigation Controllers and Table Views
10. Collection Views
11. iPad Considerations
12. Application Settings and User Defaults
13. Basic Data Persistence
14. Hey! You! Get onto iCloud!
15. Grand Central Dispatch, Background Processing, and You
16. Core Graphics: Drawing with Quartz
17. Getting Started with Sprite Kit
18. Taps, Touches, and Gestures
19. Where Am I? Finding Your Way with Core Location and Map Kit
20. Whee! Gyro and Accelerometer!
21. The Camera and Photo Library
22. Application Localization
worth mentioning, though we won’t be using it in this chapter. All subclasses of UIView, including all views and controls, have a property called tag, which is just a numeric value that you can set here or in code. The tag is designed for your use—the system will never set or change its value. If you assign a tag value to a control or view, you can be sure that the tag will always have that value unless you change it. Tags provide an easy, language-independent way of identifying objects in your
Popovers�����������������������������������������������������������������363 ■■Chapter 12: Application Settings and User Defaults������������������������������������������������������405 ■■Chapter 13: Basic Data Persistence������������������������������������������������������������������������������445 ■■Chapter 14: Documents and iCloud�������������������������������������������������������������������������������491 v vi Contents at a Glance ■■Chapter 15: Grand Central Dispatch,
right-middle resize dot to the edge. Despite this automatic behavior, you’re still free to resize the label however you want, of course. If you later decide you want the tool to pick the optimum size for you again, just press z= or select Editor ➤ Size to Fit Content. Next, resize the slider by single-clicking the slider to select it and dragging the left resize dot to the left until the blue guidelines indicate that you’re getting close to the label’s right-side edge. 126 CHAPTER 4: More User
that, if autorotation enhances the user experience, you should add it to your application. For iPad apps, the rule is you should add autorotation unless you have a compelling reason not to. Fortunately, Apple did a great job of hiding the complexities of handling orientation changes in iOS and in the UIKit, so implementing this behavior in your own iOS applications is actually quite easy. Permission to rotate the user interface is specified in the view controller. If the user rotates the device,
we’re going to build on the right (see Figure 5-23). Figure 5-23. Changing the position and size of the green view for iPhones in landscape orientation Next, we need to move the four buttons into place. As things stand now, you might find it difficult to drag the two buttons on the left, because they may be covered by the green view. So let’s first get the green view out of the way by temporarily resizing it again. Drag the bottom of the green view upward until you can see all of the buttons,