售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Core Data iOS Essentials
Table of Contents
Core Data iOS Essentials
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Overview
Prerequisite
A brief history
Enterprise Object Framework (EOF)
Core Data
Why use Xcode?
Source code
Shall we begin?
2. Understanding Core Data
Core Data
Core Data features
Data Model
Entities
Properties
Attributes
Relationships
Inverse relationship
Model View Controller (MVC)
Core Data API
Persistent Store
Persistent Store Coordinator
FetchRequest
FetchedResultsController
Overview of the application: Sales Record System for a Departmental Store
Entity Relationship Diagram
An application output sample
Entering Master Product Information
Modifying the Master Product
Deleting the Master Product
Entering customer information and order details
Deleting customer information
Searching for specific customers
Searching and modifying customer information
Entering Customer Sales Information
Automatic Master Product Update
Summary
3. Understanding Objective-C Protocol and Table View
Protocol
Implementing the Strategy pattern
Defining the protocol
Creating a delegate property
Declaring protocol methods
Creating a sample application using a protocol and a delegate
Adding the ViewController class for entering numerical values
Defining the protocol, outlets, and action methods in the SecondViewController.h header file
Defining the SecondViewController class and connecting controls
Invoking delegate methods from the SecondViewController.m implementation file
Declaring the delegate, outlet, and action methods in the demodelegateViewController.h header file
Defining the demodelegateViewController and connecting controls
Implementing the protocol methods in the demodelegateViewController.m file
Running the project
Introduction to Table View
Creating an application to display Table View cells
Declaring an array in the header file
Implementing UITableViewDataSource protocol methods
Adding names to the Table View
Adding the AddNameController View controller
Defining protocols, outlets, and action methods in the AddNameController.h header file
Defining the AddNameController class View and connecting controls
Invoking Delegate methods in the AddNameController.m implementation file
Invoking the AddNameController View and implementing the protocol methods
Placing and connecting the Bar Button Item control in the RootViewController
Summary
4. Designing a Data Model and Building Data Objects for Customers
Creating a new project
Designing the data model
Data Model Editor
Adding an entity
Adding an attribute property
Types of attributes
Fields applying constraints
Building data objects for the Customer entity
Understanding code of autogenerated files
Header file of Application Delegate
Implementation file of Application Delegate
applicationWillTerminate method
managedObjectContext method
managedObjectModel method
persistentStoreCoordinator method
applicationDocumentsDirectory method
Summary
5. Creating, Listing, and Deleting Names of Customers
Splitting the task into two modules
Creating a module to save and delete a customer's name
Using the ViewController class for adding the name of the customer
Defining protocol, outlets, and action methods in the header file
Defining the View of the AddNameController class and connecting controls
Invoking delegate methods from the implementation file
Declaring delegate and implementing methods for storing the name of the customers
Key value coding (KVC)
Key value methods
The -valueForKey: method
The -setValue:forKey: method
Keypath
Implementing the methods of the NSFetchedResultsControllerDelegate protocol
The controllerWillChangeContent method
The controllerDidChangeContent method
The controller:didChangeObject method
The controller:didChangeSection method
Running the project
Summary
6. Creating, Listing, Displaying, and Deleting Records of Customers
Understanding multiple managed object context
NSNotification
Applying the concept of multiple managed object context in our application
Enhancing our application to save, list, display, and delete customer information
Adding the ViewController class
Defining a View for entering the customer's information and connecting controls
Coding in the implementation file for accepting the customer's information and invoking delegate methods
Adding the View Controller class for displaying the customer's information
Defining the View and writing the code in the implementation file for displaying the customer's information
Implementing the methods in the RootViewController class for storing the customer's information
viewDidLoad method
cell AtIndexPath method
didSelectRowAtIndexPath method
addCustomer method
addcustomerController method
Viewing the project
Summary
7. Updating and Searching Records of Customers
Applying the update feature
Defining a protocol in the DisplayCustomerController class
Adding Edit button to enable modifications in the View of DisplayCustomerController class
Implementing the protocol's method for storing modified customer information
Using KVO to know what has been updated
Running the project
Applying search facility
Defining outlet of UISearchBar class in the header file of the RootViewController class
Placing the Search Bar control in the View of RootViewController and specifying its delegate
Implementing delegate method in the RootViewController class to apply searching
Understanding NSPredicate
Removing the keyboard after selecting a customer's name
Using Predicate Builder for creating a search criterion
Fetched properties
Fetch request templates
Building and accessing a fetch request without a variable
Building and accessing a fetch request with a variable
Summary
8. Entering, Saving, Listing, and Deleting the Records of the Products Sold to the Customers
Adding the product entity to the Data Model
Relationship
Types of relationships
One to one relationship
One to many relationship
Many to many relationship
Establishing a relationship between the Customer and the Product entities
Setting a relationship from the Customer entity to the Product entity
Delete rule
Setting a relationship from the Product entity to the Customer entity (inverse relationship)
Building the data object for the Customer and the Product entities
Understanding the role of the auto generated special methods of a relationship
Entering the information of the products sold to the customers
Creating a module to develop an interface to enter the product information
Adding a ViewController class for entering the information of the products sold to the customers
Defining the protocol, outlets, and action methods in the header file
Designing the View of the AddProductController class and connecting the controls
Invoking the delegate methods from the implementation file
Developing a module to create a menu for manipulating the product information
Adding a ViewController class to display the Product's menu to manipulate the product's information
Defining the outlets and action methods in the header file
Designing the View of a ProductInfoController class and connecting the controls
Coding in the implementation file to save, edit, and display the product's information
Creating a module to connect the Product's menu to the rest of the project
Defining the outlets and action methods in the header file
Adding a Toolbar control to the View of the DisplayCustomerController class
Coding in the implementation file to invoke the View of the ProductInfoController class
Running the project
Summary
9. Entering, Displaying, and Deleting the Stock
Adding the MasterProduct entity to the Data Model
Storing the image of the MasterProduct
Transformable data type
The Value Transformer Name: field
Creating a value transformer
Building the data object for the MasterProduct entity
Maintaining the MasterProduct information
Image Picker
Adding custom images to the Image Picker
Making an image appear within a given size
Module to develop interface to enter the information of the MasterProduct
Adding the ViewController class for entering information of the master products
Defining protocol, outlets, and action methods in the header file
Designing the View of the MasterProductController class and connecting controls
Invoking the delegate and ImagePicker methods from the implementation file
Module to create a menu for manipulating the MasterProduct information
Adding the View Controller class to display a menu for adding, editing, and displaying the MasterProducts
Defining the outlets and action methods in the header file
Designing the View of the MasterProductInfoController class and connecting controls
Coding in the implementation file to save, edit, and display the master product's information
Summary
10. Editing the Stock Information
Module to connect the MasterProduct's menu to the rest of the project
Defining outlets and action methods in the header file
Adding a Toolbar and a Bar Button Item in the RootViewController class
Coding in the implementation file to invoke the View of the MasterProductinfoController class
Making the Toolbar to appear at the bottom of the View
Running the application
Selecting the image of the master product
Deleting the master product
Module to modify the information of the master product
Adding the View Controller class to display the view to modify the selected master product
Defining the outlets and action methods in the header file
Designing the View of EditMasterProductController class
Coding in the implementation file to modify the master product's information
Importing the delegate and the View Controller class in the header file
Coding in the implementation file to invoke the View of the EditMasterProductController class
Summary
11. Displaying the Products for Sale and Updating the Stock
Displaying the products available for sale
Adding the SearchProductController class
Designing the view of SearchProductController
Coding in the SearchProductController class
Invoking the SearchProductController from the Product menu
Displaying name, price, and image of the selected product
Updating the stock
Running the project
Automatically updating the quantity of the product in the MasterProduct entity
Versioning
Creating a new Data Model version
Migrations
Implementing lightweight migration to our application
Summary
A. Appendix
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜