Synopses & Reviews
Get a solid grounding in all the fundamentals of Cocoa Touch, and avoid problems during iPhone and iPad app development. With this revised and expanded edition, youll dig into Cocoa and learn how to work effectively with Objective-C and Xcode. This book covers iOS 6 in a rigorous, orderly fashion—ideal whether youre approaching iOS for the first time or need a reference to bolster existing skills.
Learn about features introduced with iOS 6, including Objective-C language advances, autosynthesis, autolayout, new view controller rotation rules, unwind segues, state restoration, styled text, and collection views.
- Learn Objective-C language details and object-oriented programming concepts
- Understand the anatomy of an Xcode project and all the stages of its lifecycle
- Grasp key Cocoa concepts such as relationships between classes, receiving events, and model-view-controller architecture
- Learn how views and layers are managed, drawn, composited, and animated
- Become familiar with view controllers and their relationships, along with nib and storyboard management
- Fully explore all basic interface objects such as scroll views, table views, and controls
- Delve into Cocoa frameworks for sound, video, sensors, maps, and other features
- Touch on advanced topics such as threading and networking
About the Author
Matt Neuburg started programming computers in 1968, when he was 14 years old, as a member of a literally underground high school club, which met once a week to do timesharing on a bank of PDP-10s by way of primitive teletype machines. He also occasionally used Princeton University's IBM-360/67, but gave it up in frustration when one day he dropped his punch cards. He majored in Greek at Swarthmore College, and received his Ph.D. from Cornell University in 1981, writing his doctoral dissertation (about Aeschylus) on a mainframe. He proceeded to teach Classical languages, literature, and culture at many well-known institutions of higher learning, most of which now disavow knowledge of his existence, and to publish numerous scholarly articles unlikely to interest anyone. Meanwhile he obtained an Apple IIc and became hopelessly hooked on computers again, migrating to a Macintosh in 1990. He wrote some educational and utility freeware, became an early regular contributor to the online journal TidBITS, and in 1995 left academe to edit MacTech Magazine. He is also the author of Frontier: The Definitive Guide and REALbasic: The Definitive Guide. In August 1996 he became a freelancer, which means he has been looking for work ever since. He is the author of Frontier: The Definitive Guide and REALbasic: The Definitive Guide, both for O'Reilly & Associates.
Table of Contents
Preface; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments for the First Edition; Notes on the Second Printing; Acknowledgments for the Second Edition; Notes on the Second Edition; Acknowledgments for the Third Edition; Notes on the Third Edition; Language; Chapter 1: Just Enough C; 1.1 Compilation, Statements, and Comments; 1.2 Variable Declaration, Initialization, and Data Types; 1.3 Structs; 1.4 Pointers; 1.5 Arrays; 1.6 Operators; 1.7 Flow Control and Conditions; 1.8 Functions; 1.9 Pointer Parameters and the Address Operator; 1.10 Files; 1.11 The Standard Library; 1.12 More Preprocessor Directives; 1.13 Data Type Qualifiers; Chapter 2: Object-Based Programming; 2.1 Objects; 2.2 Messages and Methods; 2.3 Classes and Instances; 2.4 Class Methods; 2.5 Instance Variables; 2.6 The Object-Based Philosophy; Chapter 3: Objective-C Objects and Messages; 3.1 An Instance Reference Is a Pointer; 3.2 Messages and Methods; 3.3 Typecasting and the id Type; 3.4 Messages as Data Type; 3.5 C Functions; 3.6 CFTypeRefs; 3.7 Blocks; Chapter 4: Objective-C Classes; 4.1 Class and Superclass; 4.2 Interface and Implementation; 4.3 Header File and Implementation File; 4.4 Class Methods; 4.5 The Secret Life of Classes; Chapter 5: Objective-C Instances; 5.1 How Instances Are Created; 5.2 Polymorphism; 5.3 The Keyword self; 5.4 The Keyword super; 5.5 Instance Variables and Accessors; 5.6 Key-Value Coding; 5.7 Properties; 5.8 How to Write an Initializer; IDE; Chapter 6: Anatomy of an Xcode Project; 6.1 New Project; 6.2 The Project Window; 6.3 The Project File and Its Dependents; 6.4 The Target; 6.5 From Project to App; Chapter 7: Nib Management; 7.1 A Tour of the Nib-Editing Interface; 7.2 Nib Loading and File's Owner; 7.3 Making and Loading a Nib; 7.4 Outlet Connections; 7.5 Action Connections; 7.6 Additional Initialization of Nib-Based Instances; Chapter 8: Documentation; 8.1 The Documentation Window; 8.2 Class Documentation Pages; 8.3 Sample Code; 8.4 Other Resources; Chapter 9: Life Cycle of a Project; 9.1 Device Architecture and Conditional Code; 9.2 Localization; 9.3 Editing Your Code; 9.4 Navigating Your Code; 9.5 Debugging; 9.6 Unit Testing; 9.7 Static Analyzer; 9.8 Clean; 9.9 Running in the Simulator; 9.10 Running on a Device; 9.11 Profile and Device Management; 9.12 Version Control; 9.13 Instruments; 9.14 Distribution; 9.15 Ad Hoc Distribution; 9.16 Final App Preparations; 9.17 Submission to the App Store; Cocoa; Chapter 10: Cocoa Classes; 10.1 Subclassing; 10.2 Categories; 10.3 Protocols; 10.4 Optional Methods; 10.5 Some Foundation Classes; 10.6 The Secret Life of NSObject; Chapter 11: Cocoa Events; 11.1 Reasons for Events; 11.2 Subclassing; 11.3 Notifications; 11.4 Delegation; 11.5 Data Sources; 11.6 Actions; 11.7 The Responder Chain; 11.8 Swamped by Events; 11.9 Delayed Performance; 11.10 Application Lifetime Events; Chapter 12: Accessors and Memory Management; 12.1 Key-Value Coding; 12.2 Memory Management; 12.3 Properties; Chapter 13: Data Communication; 13.1 Model-View-Controller; 13.2 Instance Visibility; 13.3 Notifications; 13.4 Key-Value Observing; Views; Chapter 14: Views; 14.1 The Window; 14.2 Subview and Superview; 14.3 Visibility and Opacity; 14.4 Frame; 14.5 Bounds and Center; 14.6 Transform; 14.7 Layout; Chapter 15: Drawing; 15.1 UIImage and UIImageView; 15.2 Graphics Contexts; 15.3 UIImage Drawing; 15.4 CGImage Drawing; 15.5 CIFilter and CIImage; 15.6 Drawing a UIView; 15.7 Graphics Context Settings; 15.8 Paths and Drawing; 15.9 Clipping; 15.10 Gradients; 15.11 Colors and Patterns; 15.12 Graphics Context Transforms; 15.13 Shadows; 15.14 Points and Pixels; 15.15 Content Mode; Chapter 16: Layers; 16.1 View and Layer; 16.2 Layers and Sublayers; 16.3 Drawing in a Layer; 16.4 Transforms; 16.5 Shadows, Borders, and More; 16.6 Layer Efficiency; 16.7 Layers and Key-Value Coding; Chapter 17: Animation; 17.1 Drawing, Animation, and Threading; 17.2 UIImageView and UIImage Animation; 17.3 View Animation; 17.4 Implicit Layer Animation; 17.5 Core Animation; 17.6 Animation and Autolayout; 17.7 Actions; 17.8 Emitter Layers; 17.9 CIFilter Transitions; Chapter 18: Touches; 18.1 Touch Events and Views; 18.2 Receiving Touches; 18.3 Restricting Touches; 18.4 Interpreting Touches; 18.5 Gesture Recognizers; 18.6 Touch Delivery; Interface; Chapter 19: View Controllers; 19.1 The View Controller Hierarchy; 19.2 View Controller and View Creation; 19.3 Rotation; 19.4 Presented View Controller; 19.5 Tab Bar Controllers; 19.6 Navigation Controllers; 19.7 Page View Controller; 19.8 Container View Controllers; 19.9 Storyboards; 19.10 View Controller Lifetime Events; 19.11 View Controller Memory Management; 19.12 State Restoration; Chapter 20: Scroll Views; 20.1 Creating a Scroll View; 20.2 Scrolling; 20.3 Zooming; 20.4 Scroll View Delegate; 20.5 Scroll View Touches; 20.6 Scroll View Performance; Chapter 21: Table Views and Collection Views; 21.1 Table View Cells; 21.2 Table View Data; 21.3 Table View Selection; 21.4 Table View Scrolling and Layout; 21.5 Table View State Restoration; 21.6 Table View Searching; 21.7 Table View Editing; 21.8 Table View Menus; 21.9 Collection Views; Chapter 22: Popovers and Split Views; 22.1 Configuring and Displaying a Popover; 22.2 Managing a Popover; 22.3 Dismissing a Popover; 22.4 Popovers and Presented Views; 22.5 Popover Segues; 22.6 Automatic Popovers; 22.7 Split Views; Chapter 23: Text; 23.1 Attributed Strings; 23.2 UILabel; 23.3 UITextField; 23.4 UITextView; 23.5 Core Text; Chapter 24: Web Views; 24.1 Loading Web View Content; 24.2 Web View State Restoration; 24.3 Communicating with a Web View; Chapter 25: Controls and Other Views; 25.1 UIActivityIndicatorView; 25.2 UIProgressView; 25.3 UIPickerView; 25.4 UISearchBar; 25.5 UIControl; 25.6 Bars; 25.7 Appearance Proxy; Chapter 26: Modal Dialogs; 26.1 Alert View; 26.2 Action Sheet; 26.3 Dialog Alternatives; 26.4 Local Notifications; 26.5 Activity View; Some Frameworks; Chapter 27: Audio; 27.1 System Sounds; 27.2 Audio Session; 27.3 Audio Player; 27.4 Remote Control of Your Sound; 27.5 Playing Sound in the Background; 27.6 Further Topics in Sound; Chapter 28: Video; 28.1 MPMoviePlayerController; 28.2 MPMoviePlayerViewController; 28.3 UIVideoEditorController; 28.4 Introduction to AV Foundation Video; Chapter 29: Music Library; 29.1 Exploring the Music Library; 29.2 The Music Player; 29.3 The Music Picker; Chapter 30: Photo Library and Image Capture; 30.1 UIImagePickerController; 30.2 Image Capture With AV Foundation; 30.3 The Assets Library Framework; Chapter 31: Address Book; 31.1 Address Book Database; 31.2 Address Book Interface; Chapter 32: Calendar; 32.1 Calendar Database; 32.2 Calendar Interface; Chapter 33: Mail and Messages; 33.1 Mail Message; 33.2 Text Message; 33.3 Twitter Post; Chapter 34: Maps; 34.1 Displaying a Map; 34.2 Annotations; 34.3 Overlays; 34.4 Map Kit and Current Location; 34.5 Geocoding; 34.6 Communicating With the Maps App; Chapter 35: Sensors; 35.1 Location; 35.2 Heading; 35.3 Acceleration and Attitude; Final Topics; Chapter 36: Persistent Storage; 36.1 The Sandbox; 36.2 Basic File Operations; 36.3 Saving and Reading Files; 36.4 User Defaults; 36.5 File Sharing; 36.6 Document Types; 36.7 Handing Off a Document; 36.8 The Document Architecture; 36.9 iCloud; 36.10 XML; 36.11 SQLite; 36.12 Core Data; 36.13 Image File Formats; Chapter 37: Basic Networking; 37.1 HTTP Requests; 37.2 Bonjour; 37.3 Push Notifications; 37.4 Beyond Basic Networking; Chapter 38: Threads; 38.1 The Main Thread; 38.2 Why Threading Is Hard; 38.3 Three Ways of Threading; 38.4 Threads and App Backgrounding; Chapter 39: Undo; 39.1 The Undo Manager; 39.2 The Undo Interface; 39.3 The Undo Architecture; Chapter 40: Epilogue; Index; Colophon;