Inherits from OCRBaseDetailTableViewController : UITableViewController
Conforms to NSFetchedResultsControllerDelegate
UIPopoverPresentationControllerDelegate
UITableViewDataSource
UITableViewDelegate
UITextFieldDelegate
Declared in OCRResumeEducationViewController.h
OCRResumeEducationViewController.m

Overview

Manage education object.

Properties

datePickerController

Reference to the date picker view controller.

@property (nonatomic, strong) OCRDatePickerViewController *datePickerController

Discussion

We keep a reference so we can dismiss it in horizontal compact size, where it is presented as a modal.

Declared In

OCRResumeEducationViewController.m

eduFetchedResultsController

Reference to the fetchResultsController.

@property (nonatomic, strong) NSFetchedResultsController *eduFetchedResultsController

Declared In

OCRResumeEducationViewController.m

noSelectionView

Reference to the noSelection view, which is displayed when there is no object to manage, or a containing parent object is deleted.

@property (strong, nonatomic) OCRNoSelectionViewController *noSelectionView

Declared In

OCRResumeEducationViewController.m

tableView

IBOutlet to the tableView.

@property (strong, nonatomic) IBOutlet UITableView *tableView

Declared In

OCRResumeEducationViewController.h

Instance Methods

adaptivePresentationStyleForPresentationController:

Asks the delegate for the new presentation style to use.

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller

Parameters

controller

The presentation controller that is managing the size change. Use this object to retrieve the view controllers involved in the presentation.

Return Value

The new presentation style, which must be either UIModalPresentationFullScreen or UIModalPresentationOverFullScreen.

Discussion

The presentation controller calls this method when the app is about to change to a horizontally compact environment. Use this method to indicate that you want the presented view controller to transition to one of the full-screen presentation styles.

If you do not implement this method or return any style other than UIModalPresentationFullScreen or UIModalPresentationOverFullScreen, the presentation controller adjusts the presentation style to the UIModalPresentationFullScreen style.

Declared In

OCRResumeEducationViewController.m

addEducation:

Add a Jobs entity for this resume.

- (void)addEducation:(NSString *)educationName

Parameters

educationName

The name to assign to the new entity.

Declared In

OCRResumeEducationViewController.m

configureDefaultNavBar

Configure the default items for the navigation bar.

- (void)configureDefaultNavBar

Declared In

OCRResumeEducationViewController.m

configureFieldsForEditing:

Enables or disables all the UI text fields for editing.

- (void)configureFieldsForEditing:(BOOL)editable

Parameters

editable

A BOOL that determines whether the fields should be enabled for editing - or not.

Discussion

As a resume app, a major Use Case is the user sharing his/her experience by passing the iOS device around. To avoid accidently changing information, the app defaults to non-editable and there is an explicit Edit button when the user wants to change information. This method sets the enabled state as appropriate and also changes the background color to make “edit mode” more visually distinct.

Declared In

OCRResumeEducationViewController.m

configureUIForEditing:

Set the UI for for editing enabled or disabled.

- (void)configureUIForEditing:(BOOL)isEditingMode

Parameters

isEditingMode

YES if we are going into edit mode, NO otherwise.

Discussion

Called when the user presses the Edit, Done, or Cancel buttons.

Declared In

OCRResumeEducationViewController.m

configureView

Configure the view items.

- (void)configureView

Declared In

OCRResumeEducationViewController.m

datePickerDidChangeDate:

Called by the datePicker when the user changes the date.

- (void)datePickerDidChangeDate:(UIDatePicker *)datePicker

Parameters

datePicker

The UIDatePicker managing the date change. Use this object to retrieve the date.

Declared In

OCRResumeEducationViewController.m

didPressAddButton:

Called when the user presses the “+” button in the section header.

- (IBAction)didPressAddButton:(id)sender

Parameters

sender

The button pressed.

Declared In

OCRResumeEducationViewController.m

didPressCancelButton

Invoked when the user taps the Cancel button.

- (void)didPressCancelButton

Discussion

  • End the undo group on the NSManagedObjectContext.
  • If the undoManager has changes it canUndo, undo them.
  • Cleanup the undoManager.
  • Reset the UI to its default state.

Declared In

OCRResumeEducationViewController.m

didPressDoneButton:

Called when the user taps the Done button of a presented OCRDatePickerViewController.

- (void)didPressDoneButton:(id)sender

Parameters

sender

The object initiating the dismiss action (the Done UIBarButtonItem).

Declared In

OCRResumeEducationViewController.m

eduFetchedResultsController

Singleton method to retrieve the eduFetchedResultsController, instantiating it if necessary.

- (NSFetchedResultsController *)eduFetchedResultsController

Return Value

An initialized NSFetchedResultsController.

Declared In

OCRResumeEducationViewController.m

loadViewFromSelectedObject

Update the text fields of the view from the selected managed object.

- (void)loadViewFromSelectedObject

Declared In

OCRResumeEducationViewController.m

numberOfSectionsInTableView:

Asks the data source to return the number of sections in the table view.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

Parameters

tableView

An object representing the table view requesting this information.

Return Value

The number of sections in tableView. The default value is 1.

Declared In

OCRResumeEducationViewController.m

packageWasDeleted:

Update internal state of the view controller when a package has been deleted.

- (void)packageWasDeleted:(NSNotification *)aNotification

Parameters

aNotification

The NSNotification object associated with the event.

Discussion

Invoked by notification posted by OCRPackagesViewController when it performs a package deletion.

Declared In

OCRResumeEducationViewController.m

parentCellForView:

Search the UIView hierarchy to find the UITableViewCell that is the parent of the view.

- (UITableViewCell *)parentCellForView:(UIView *)view

Parameters

view

The UIView for whom the caller would like the parent UITableViewCell.

Return Value

The UITableViewCell that is the parent of view, or nil if none is found.

Discussion

This is a recursive method, searching through the superviews of the view. Eventually either a UITableViewCell is found, or the top of the superview chain is reached and the method returns nil.

Declared In

OCRResumeEducationViewController.m

populateFieldsFromSelectedObject

Populate the user interface fields with data from the object we are managing.

- (void)populateFieldsFromSelectedObject

Declared In

OCRResumeEducationViewController.m

presentationController:viewControllerForAdaptivePresentationStyle:

Asks the delegate for the view controller to display when adapting to the specified presentation style.

- (UIViewController *)presentationController:(UIPresentationController *)controller viewControllerForAdaptivePresentationStyle:(UIModalPresentationStyle)style

Parameters

controller

The presentation controller that is managing the size class change.

style

The new presentation style that is about to be employed to display the view controller.

Return Value

The view controller to display in place of the existing presented view controller.

Discussion

When a size class change causes a change to the underlying presentation style, the presentation controller calls this method to ask for the view controller to display in that new style. This method is your opportunity to replace the current view controller with one that is better suited for the new presentation style. For example, you might use this method to insert a navigation controller into your view hierarchy to facilitate pushing new view controllers more easily in the compact environment. In that instance, you would return a navigation controller whose root view controller is the currently presented view controller. You could also return an entirely different view controller if you prefer.

If you do not implement this method or your implementation returns nil, the presentation controller uses its existing presented view controller.

Declared In

OCRResumeEducationViewController.m

reloadFetchedResults:

Reloads the fetched results

- (void)reloadFetchedResults:(NSNotification *)aNote

Parameters

aNote

the NSNotification describing the changes (ignored)

Discussion

Invoked by notification when the underlying data objects may have changed

Declared In

OCRResumeEducationViewController.m

setEditing:animated:

Sets whether the view controller shows an editable view.

- (void)setEditing:(BOOL)editing animated:(BOOL)animated

Parameters

editing

If YES, the view controller should display an editable view; otherwise, NO. If YES and one of the custom views of the navigationItem property is set to the value returned by the editButtonItem method, the associated navigation controller displays a Done button; otherwise, an Edit button.

animated

If YES, animates the transition; otherwise, does not.

Discussion

Subclasses that use an edit-done button must override this method to change their view to an editable state if editing is YES and a non-editable state if it is NO. This method should invoke super’s implementation before updating its view.

Declared In

OCRResumeEducationViewController.m

tableView:canEditRowAtIndexPath:

Asks the data source to verify that the given row is editable.

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

The table-view object requesting this information.

indexPath

An index path locating a row in tableView.

Return Value

YES to allow editing, NO otherwise,

Declared In

OCRResumeEducationViewController.m

tableView:cellForRowAtIndexPath:

Asks the data source for a cell to insert in a particular location of the table view.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

A table-view object requesting the cell.

indexPath

An index path locating a row in tableView.

Return Value

An object inheriting from UITableViewCell that the table view can use for the specified row. An assertion is raised if you return nil.

Discussion

The returned UITableViewCell object is frequently one that the application reuses for performance reasons. You should fetch a previously created cell object that is marked for reuse by sending a dequeueReusableCellWithIdentifier: message to tableView. Various attributes of a table cell are set automatically based on whether the cell is a separator and on information the data source provides, such as for accessory views and editing controls.

Declared In

OCRResumeEducationViewController.m

tableView:commitEditingStyle:forRowAtIndexPath:

Asks the data source to commit the insertion or deletion of a specified row in the receiver.

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

The table-view object requesting the insertion or deletion.

editingStyle

The cell editing style corresponding to a insertion or deletion requested for the row specified by indexPath. Possible editing styles are UITableViewCellEditingStyleInsert or UITableViewCellEditingStyleDelete.

indexPath

An index path locating the row in tableView.

Discussion

When users tap the insertion (green plus) control or Delete button associated with a UITableViewCell object in the table view, the table view sends this message to the data source, asking it to commit the change. (If the user taps the deletion (red minus) control, the table view then displays the Delete button to get confirmation.) The data source commits the insertion or deletion by invoking the UITableView methods insertRowsAtIndexPaths:withRowAnimation: or deleteRowsAtIndexPaths:withRowAnimation:, as appropriate.

To enable the swipe-to-delete feature of table views (wherein a user swipes horizontally across a row to display a Delete button), you must implement this method.

You should not call setEditing:animated: within an implementation of this method. If for some reason you must, invoke it after a delay by using the performSelector:withObject:afterDelay: method.

Declared In

OCRResumeEducationViewController.m

tableView:didSelectRowAtIndexPath:

Tells the delegate that the specified row is now selected.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

A table-view object informing the delegate about the new row selection.

indexPath

An index path locating the new selected row in tableView.

Discussion

The delegate handles selections in this method. One of the things it can do is exclusively assign the check-mark image (UITableViewCellAccessoryCheckmark) to one row in a section (radio-list style). This method isn’t called when the editing property of the table is set to YES (that is, the table view is in editing mode). See “Managing Selections” in Table View Programming Guide for iOS for further information (and code examples) related to this method.

Declared In

OCRResumeEducationViewController.m

tableView:educationCellForIndexPath:

Configure an education cell for the resume.

- (OCREducationTableViewCell *)tableView:(UITableView *)tableView educationCellForIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

A table-view object requesting the cell.

indexPath

The indexPath of the section and row the cell represents.

Declared In

OCRResumeEducationViewController.m

tableView:heightForHeaderInSection:

Asks the delegate for the height to use for the header of a particular section.

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

Parameters

tableView

The table-view object requesting this information.

section

An index number identifying a section of tableView .

Return Value

A nonnegative floating-point value that specifies the height (in points) of the header for section.

Discussion

This method allows the delegate to specify section headers with varying heights.

Declared In

OCRResumeEducationViewController.m

tableView:moveRowAtIndexPath:toIndexPath:

Tells the data source to move a row at a specific location in the table view to another location.

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath

Parameters

tableView

The table-view object requesting this action.

fromIndexPath

An index path locating the row to be moved in tableView.

toIndexPath

An index path locating the row in tableView that is the destination of the move.

Discussion

The UITableView object sends this message to the data source when the user presses the reorder control in fromRow.

Declared In

OCRResumeEducationViewController.m

tableView:numberOfRowsInSection:

Tells the data source to return the number of rows in a given section of a table view.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

Parameters

tableView

The table-view object requesting this information.

section

An index number identifying a section in tableView.

Return Value

The number of rows in section.

Declared In

OCRResumeEducationViewController.m

tableView:viewForHeaderInSection:

Asks the delegate for a view object to display in the header of the specified section of the table view.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

Parameters

tableView

The table-view object asking for the view object.

section

An index number identifying a section of tableView .

Return Value

A view object to be displayed in the header of section .

Discussion

The returned object can be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.

Declared In

OCRResumeEducationViewController.m

textFieldDidBeginEditing:

Tells the delegate that editing began for the specified text field.

- (void)textFieldDidBeginEditing:(UITextField *)textField

Parameters

textField

The text field for which an editing session began.

Discussion

This method notifies the delegate that the specified text field just became the first responder. You can use this method to update your delegate’s state information. For example, you might use this method to show overlay views that should be visible while editing.

Implementation of this method by the delegate is optional.

Declared In

OCRResumeEducationViewController.m

textFieldDidEndEditing:

Tells the delegate that editing of the specified text view has ended.

- (void)textFieldDidEndEditing:(UITextField *)textField

Parameters

textField

The text field in which editing ended.

Discussion

Implementation of this method is optional. A text view sends this message to its delegate after it closes out any pending edits and resigns its first responder status. You can use this method to tear down any data structures or change any state information that you set when editing began.

Declared In

OCRResumeEducationViewController.m

textFieldShouldBeginEditing:

Asks the delegate if editing should begin in the specified text field.

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField

Parameters

textField

The text field for which editing is about to begin.

Return Value

YES if an editing session should be initiated; otherwise, NO to disallow editing.

Discussion

When the user performs an action that would normally initiate an editing session, the text field calls this method first to see if editing should actually proceed. In most circumstances, you would simply return YES from this method to allow editing to proceed.

Implementation of this method by the delegate is optional. If it is not present, editing proceeds as if this method had returned YES.

Declared In

OCRResumeEducationViewController.m

textFieldShouldReturn:

Asks the delegate if the text field should process the pressing of the return button.

- (BOOL)textFieldShouldReturn:(UITextField *)textField

Parameters

textField

The text field whose return button was pressed.

Return Value

YES if the text field should implement its default behavior for the return button; otherwise, NO.

Discussion

The text field calls this method whenever the user taps the return button. You can use this method to implement any custom behavior when the button is tapped.

In our Storyboard scene, we set the textfield tag values incrementally, and then use the tag of the current textField responder to determine what to do next. We also set the other keyboard atttributes appropriately for] the data type we expect to see, and in particular set the return key to “Next” if hitting return will advance the user to the next field.

Note the specific check for the date fields, in which case we bring up the data picker.

Declared In

OCRResumeEducationViewController.m

textViewDidEndEditing:

Tells the delegate that editing of the specified text view has ended.

- (void)textViewDidEndEditing:(UITextView *)textView

Parameters

textView

The text view in which editing ended.

Discussion

Implementation of this method is optional. A text view sends this message to its delegate after it closes out any pending edits and resigns its first responder status. You can use this method to tear down any data structures or change any state information that you set when editing began.

Declared In

OCRResumeEducationViewController.m

textViewShouldBeginEditing:

Asks the delegate if editing should begin in the specified text view.

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView

Parameters

textView

The text view for which editing is about to begin.

Return Value

YES if an editing session should be initiated; otherwise, NO to disallow editing.

Discussion

When the user performs an action that would normally initiate an editing session, the text view calls this method first to see if editing should actually proceed. In most circumstances, you would simply return YES from this method to allow editing to proceed.

Implementation of this method by the delegate is optional. If it is not present, editing proceeds as if this method had returned YES.

Declared In

OCRResumeEducationViewController.m

updateSelectedObjectFromUI

Update the selected object’s properties from the view’s data fields

- (void)updateSelectedObjectFromUI

Declared In

OCRResumeEducationViewController.m

updateSourceObjectWithTextField:forTableCell:atIndexPath:

Update the object represented by the updated text field.

- (void)updateSourceObjectWithTextField:(UITextField *)textField forTableCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath

Parameters

textField

The UITextField updated by OCREducationTextViewCell

cell

The OCREducationTextViewCell representing the education object

indexPath

The indexPath of the section and row the cell represents.

Declared In

OCRResumeEducationViewController.m

viewDidLoad

Called after the controller’s view is loaded into memory.

- (void)viewDidLoad

Discussion

This method is called after the view controller has loaded its view hierarchy into memory. This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView method. You usually override this method to perform additional initialization on views that were loaded from nib files.

Declared In

OCRResumeEducationViewController.m

viewWillAppear:

Notifies the view controller that its view is about to be added to a view hierarchy.

- (void)viewWillAppear:(BOOL)animated

Parameters

animated

If YES, the view is being added to the window using an animation.

Discussion

This method is called before the receiver’s view is about to be added to a view hierarchy and before any animations are configured for showing the view. You can override this method to perform custom tasks associated with displaying the view. For example, you might use this method to change the orientation or style of the status bar to coordinate with the orientation or style of the view being presented. If you override this method, you must call super at some point in your implementation.

For more information about the how views are added to view hierarchies by a view controller, and the sequence of messages that occur, see “Responding to Display-Related Notifications”.

Note If a view controller is presented by a view controller inside of a popover, this method is not invoked on the presenting view controller after the presented controller is dismissed.

Declared In

OCRResumeEducationViewController.m