The addCustomer
method is invoked when the user selects the plus (+) button in the navigation bar. This method displays a View that prompts the user to enter the name, email id, and contact number of the customer. On selecting the Save button (after entering the name of the customer), a new managed object is created and inserted. We can see in the code that we create and initialize an instance of the AddCustomerController
class by the name: addcustomerController
. Also, we set the current View Controller file: RootViewController.m
as the delegate of the addcustomerController
instance. That is, this class will implement the delegate methods of the AddCustomerController
class. Then we insert a new managed object into the managed context using the class method on NSEntityDescription
. Also, we return the instance of class that represents the entity (Customer)
and assign it to the cust
object of addcustomerController
(instance of AddCustomerController
class)
To display a navigation...