Rights Contact Login For More Details
- Wiley
More About This Title Professional iPhone and iPad Database ApplicationProgramming
- English
English
- English
English
INTRODUCTION xxiii
PART I: MANIPULATING AND DISPLAYING DATA ON THE IPHONE AND IPAD
CHAPTER 1: INTRODUCING DATA-DRIVEN APPLICATIONS 3
Building a Simple Data-Driven Application 3
Creating the Project 4
Adding a UITableView 6
Model-View-Controller Architecture 6
Adding the TableView Programmatically 7
Retrieving Data 8
Implementing Your Data Model Class 9
Displaying the Data 12
Protocols 12
Implementing the UITableViewDataSource Protocol 13
Delegates 15
Finishing Up 15
Further Exploration 17
Design Patterns 17
Reading a Text File 18
Moving Forward 18
CHAPTER 2: THE IPHONE AND IPAD DATABASE: SQLITE 19
What Is SQLite? 20
The SQLite Library 20
SQLite and Core Data 20
Building a Simple Database 21
Designing the Database 22
Creating the Database 24
Populating the Database 26
Creating Records with the INSERT Command 26
Reading Your Rows with the SELECT Command 28
Tools to Visualize the SQLite Database 31
Connecting to Your Database 33
Starting the Project 34
The UINavigationController 34
The UITableViewController 35
The Model Class 36
The DBAccess Class 37
Parameterized Queries 47
Writing to the Database 49
Displaying the Catalog 50
Viewing Product Details 52
Moving Forward 55
CHAPTER 3: DISPLAYING YOUR DATA: THE UITABLEVIEW 57
Customizing the TableView 57
TableViewCell Styles 58
Adding Subviews to the contentView 61
Subclassing UITableViewCell 65
Getting Started 66
Implementing drawRect: 69
Finishing Up 71
Implementing Sections and an Index 72
Implementing Search 78
Optimizing TableView Performance 85
Reusing Existing Cells 85
Opaque Subviews 86
Custom Drawn Cells with drawRect 88
UI Conventions for Accessory Views 88
Moving Forward 88
CHAPTER 4: IPAD INTERFACE ELEMENTS 89
Displaying Master/Detail Data with the UISplitViewController 89
Introducing the UISplitViewController 90
The UISplitViewControllerDelegate Protocol 92
Starting the Split View Sample Application 93
Building the Detail Interface 95
Implementing Save and Master/Detail View 97
Setting Up the DetailViewController 97
Changes to the RootViewController 99
Modify the TableView Methods 100
Adding Surveys 101
Displaying Data in a Popover 103
Building the InfoViewController 104
Displaying the UIPopoverController 107
Gesture Recognizers 110
The UIGestureRecognizer Class 110
Using Gesture Recognizers 111
File Sharing Support 115
Enable File Sharing in the Sample Application 115
Serializing the Survey Data Array 115
Deserializing and Loading the Survey Data Array 117
Sharing the Data 118
Moving Forward 119
PART II: MANAGING YOUR DATA WITH CORE DATA
CHAPTER 5: INTRODUCING CORE DATA 123
The Basics of Core Data 124
The Core Data Architecture 124
The Core Data Stack 124
The Data Store 125
The Persistent Store Coordinator 125
The Managed Object Model 126
The Managed Object Context 126
SQLite and Core Data 127
Using Core Data: A Simple Task Manager 127
Creating the Project 127
Examining the Template Code 128
TasksAppDelegate 128
The Data Model 131
RootViewController 132
Modifying the Template Code 137
Moving Forward 143
CHAPTER 6: MODELING DATA IN XCODE 145
Modeling Your Data 145
Defi ning Entities and Their Attributes 146
Entity Details 147
Adding Attributes 149
Adding Relationships Between Entities 150
Creating Fetched Properties and Fetch Request Templates 153
Fetched Properties 153
Fetch Request Templates 155
Creating Custom NSManagedObject Subclasses 155
Implementing Validation Rules 158
Implementing Default Values 159
Creating the Tasks Model 159
Moving Forward 161
CHAPTER 7: BUILDING A CORE DATA APPLICATION 163
The Tasks Application Architecture 163
The Data Model 164
The Class Model 164
The User Interface 165
Coding the Application 167
RootViewController and the Basic UI 167
Generating the Managed Object Subclasses 171
Adding and Viewing Tasks 172
Building the ViewTaskController 173
Changes to the RootViewController 178
Building the Editing Controllers 180
Editing Text with the EditTextController 181
Setting Priorities with the EditPriorityController 185
Adding and Editing Locations with the EditLocationController 189
Modifying Dates with the EditDateController 195
Finishing Up the Editing Controllers 199
Displaying Results in the RootViewController 203
Sorting Results with NSSortDescriptor 203
Filtering Results with NSPredicate 204
Generating Grouped Tables Using the NSFetchedResultsController 205
Implementing Custom Managed Objects 211
Coding a Dynamic Property 211
Defaulting Data at Runtime 212
Validating a Single Field 213
Multi-Field Validation 215
Moving Forward 217
CHAPTER 8: CORE DATA–RELATED COCOA FEATURES 219
Key-Value Coding 220
Keys and Keypaths 220
Setting Values Using Keys 221
Collection Operators 221
Additional Considerations When Using KVC 222
Key-Value Observing 222
Observing Changes to an Object 223
Automatic and Manual Implementations of KVO 224
Key-Value Observing Example 224
Building the User Interface 225
The Counter Data Object 226
Implementing Key-Value Observing 227
Updating Values with Key-Value Coding 229
Using NSPredicate 231
Creating Predicates 231
Using Predicates 232
Sort Descriptors 233
Moving Forward 234
CHAPTER 9: CORE DATA MIGRATION AND PERFORMANCE 235
Model Versioning and Schema Migration 235
Model Versioning 237
Lightweight Migration 239
Generating a Mapping Model 242
Safely Threading with Core Data 246
Designing for Threading 246
Threading and Core Data 247
Threading with NSOperation 248
Core Data Threading Example 249
Blocking the Main Thread 251
Moving the Blocking Call 252
Core Data Performance 257
Faulting 258
Data Store Types 259
Storing Binary Data 259
Entity Inheritance 260
Runtime Performance 260
Managing Changes with the Fetched Results Controller 261
Performance Analysis Using Instruments 264
Starting Instruments 264
The Instruments Interface 266
The Core Data Instruments 267
Moving Forward 268
PART III: APPLICATION INTEGRATION USING WEB SERVICES
CHAPTER 10: WORKING WITH XML ON THE IPHONE 271
iPhone SDK and the Web 271
Web Application Architecture 272
Synchronous Data Retrieval 273
The URL Loading System 273
Web Access Sample 275
Starting the Application 275
Building the Interface 276
Requesting Data from the Server 277
Creating the Request 277
NSURLConnection Delegate Methods 278
Finishing Up 282
XML and the iPhone SDK 282
Brief Overview of XML 282
Parsing XML with NSXML Parser 283
Extending the Example, Parsing the XML 285
Starting Out 285
Setting Up to Parse 286
Modifying the Interface 288
Implementing the Parser Delegate Methods 288
Generating XML with libxml 291
XML Generation Sample 292
Moving Forward 300
CHAPTER 11: INTEGRATING WITH WEB SERVICES 301
Network Application Architecture 301
Two-Tier Architecture 302
Three-Tier Architecture (n-tier) 303
Application Communication 304
Introducing Web Services 304
SOAP Messaging 306
The REST Protocol 307
Example 1: Location-Based Search 308
Starting Out 308
Building the Interface 310
Core Location 310
The Core Location Framework 311
Using Core Location 312
The Local Search API 313
Using the Search Bar 315
Handling the Web Service Response 318
The NSURLConnection Delegate Methods 318
Defi ning the Result Class 320
Parsing the Response XML 322
Using MapKit 327
Finishing Up 331
Example 2: Term Extraction 332
Getting Started 332
Building the User Interface 334
Implementing the POST Call 335
Receiving the XML Response 338
Parsing the Response XML 340
Finishing Up 342
Moving Forward 342
APPENDIX A: TOOLS FOR TROUBLESHOOTING YOUR APPLICATIONS 343
Instruments 343
Starting Instruments 344
The Trace Document 345
Objective-C Memory Management 346
Sample Memory Leak Application 348
Analyzing a Memory Leak in Instruments 349
The Static Analyzer 351
INDEX 355