
Questo prodotto usufruisce delle SPEDIZIONI GRATIS
selezionando l'opzione Corriere Veloce in fase di ordine.
Pagabile anche con Carta della cultura giovani e del merito, Carta della Cultura e Carta del Docente
As the iPhone and iPad grow in popularity, there is a growing demand for applications that are focused on data. Developers need to know how to get data on to these devices, deal with and create data, and communicate with external services this book satisfies that need. Award–winning developer Patrick Alessi walks you through the flow of data in an enterprise application. The in–depth coverage of displaying and manipulating data, creating and managing data using Core Data, and integrating your applications using web services puts you on your way to implementing data–driven applications for the iPhone or iPad.
Professional iPhone and iPad Database Application Programming:
Explains extracting data from large–scale database, such as Oracle, MySQL, or SQL Server
Demonstrates how to customize the UITable View to display data how you want it
Includes extensive coverage of the Core Data API including data modeling and visioning using Xcode's Data Model design tool
Demonstrates how to build iPad interfaces using that device's unique UI elements
Wrox Professional guides are planned and written by working programmers to meet the real–world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job.
wrox.com
Programmer Forums
Join our Programmer to Programmer forums to ask and answer programming questions about this book, join discussions on the hottest topics in the industry, and connect with fellow programmers from around the world.
Code Downloads
Take advantage of free code samples from this book, as well as code samples from hundreds of other books, all ready to use.
Read More
Find articles, ebooks, sample chapters, and tables of contents for hundreds of books, and more reference resources on programming topics that matter to you.
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 X


Il sito utilizza cookie ed altri strumenti di tracciamento che raccolgono informazioni dal dispositivo dell’utente. Oltre ai cookie tecnici ed analitici aggregati, strettamente necessari per il funzionamento di questo sito web, previo consenso dell’utente possono essere installati cookie di profilazione e marketing e cookie dei social media. Cliccando su “Accetto tutti i cookie” saranno attivate tutte le categorie di cookie. Per accettare solo deterninate categorie di cookie, cliccare invece su “Impostazioni cookie”. Chiudendo il banner o continuando a navigare saranno installati solo cookie tecnici. Per maggiori dettagli, consultare la Cookie Policy.