addCustomer method

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 bar in the View of AddCustomerController, we create and initialize an instance of the UINavigationController class by the name: navController and set its Root View controller to be the view of the AddCustomerController class. Then we display the View of the AddCustomercontroller modally using the presentModalViewController:animated: method, the view controller animates the appearance of the View and creates a parent-child relationship between the current View controller and the modal view controller.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.216.38