Inherits from UITableViewController
Conforms to NSFetchedResultsControllerDelegate
UISplitViewControllerDelegate
UITableViewDataSource
UITableViewDelegate
Declared in OCRPackagesTableViewController.h
OCRPackagesTableViewController.m

Overview

Manage Packages objects.

It uses a UITableView to display the list of Packages, and dispatches OCRCoverLtrViewController or OCRResumeOverViewController.

Properties

fetchedResultsController

Reference to the fetchResultsController.

@property (nonatomic, strong) NSFetchedResultsController *fetchedResultsController

Declared In

OCRPackagesTableViewController.m

managedObjectContext

The managed object context used throughout KOResume.

@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext

Declared In

OCRPackagesTableViewController.h

packagesPopoverController

The popoverController of the for the splitView.

@property (nonatomic, strong) UIPopoverController *packagesPopoverController

Declared In

OCRPackagesTableViewController.m

rootPopoverButtonItem

The back button for the root popover.

@property (nonatomic, strong) UIBarButtonItem *rootPopoverButtonItem

Declared In

OCRPackagesTableViewController.m

Instance Methods

addPackage:

Add a new Package object.

- (void)addPackage:(NSString *)packageName

Parameters

packageName

The name of the Package to add.

Declared In

OCRPackagesTableViewController.m

configureCell:atIndexPath:

Helper method to configure a cell when asked by the table view.

- (void)configureCell:(OCRPackagesCell *)cell atIndexPath:(NSIndexPath *)indexPath

Parameters

cell

The cell to configure.

indexPath

The indexPath for the cell needed.

Return Value

A configured cell.

Declared In

OCRPackagesTableViewController.m

configureDefaultNavBar

Configure the default items for the navigation bar.

- (void)configureDefaultNavBar

Declared In

OCRPackagesTableViewController.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

OCRPackagesTableViewController.m

didPressAddButton:

Invoked when the user taps the ‘+’ button in the section header.

- (IBAction)didPressAddButton:(id)sender

Parameters

sender

The UIButton object sending the message.

Declared In

OCRPackagesTableViewController.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 non-editing state.

Declared In

OCRPackagesTableViewController.m

didPressCoverLtrButton:

Handle the cover letter button.

- (IBAction)didPressCoverLtrButton:(id)sender

Parameters

sender

The UIButton pressed.

Declared In

OCRPackagesTableViewController.m

didPressResumeButton:

Handle the resume button.

- (IBAction)didPressResumeButton:(id)sender

Parameters

sender

The UIButton pressed.

Declared In

OCRPackagesTableViewController.m

didReceiveMemoryWarning

Sent to the view controller when the app receives a memory warning.

- (void)didReceiveMemoryWarning

Discussion

Your app never calls this method directly. Instead, this method is called when the system determines that the amount of available memory is low.

You can override this method to release any additional memory used by your view controller. If you do, your implementation of this method must call the super implementation at some point.

Declared In

OCRPackagesTableViewController.m

fetchedResultsController

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

- (NSFetchedResultsController *)fetchedResultsController

Return Value

An initialized NSFetchedResultsController.

Declared In

OCRPackagesTableViewController.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

OCRPackagesTableViewController.m

postDeleteNotification

Post a notification informing listeners that a package has been deleted.

- (void)postDeleteNotification

Discussion

Listeners should register for this notication and take appropriate action to ensure orphaned child objects are not updated inadvertently.

Declared In

OCRPackagesTableViewController.m

prepareForSegue:sender:

Notifies the view controller that a segue is about to be performed.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

Parameters

segue

The segue object containing information about the view controllers involved in the segue.

sender

The object that initiated the segue. You might use this parameter to perform different actions based on which control (or other object) initiated the segue.

Discussion

The default implementation of this method does nothing. Your view controller overrides this method when it needs to pass relevant data to the new view controller. The segue object describes the transition and includes references to both view controllers involved in the segue.

Because segues can be triggered from multiple sources, you can use the information in the segue and sender parameters to disambiguate between different logical paths in your app. For example, if the segue originated from a table view, the sender parameter would identify the table view cell that the user tapped. You could use that information to set the data on the destination view controller.

Declared In

OCRPackagesTableViewController.m

reloadFetchedResults:

Loads a fresh copy of fetched results.

- (void)reloadFetchedResults:(NSNotification *)note

Parameters

note

The NSNotification object associated with the event that triggered the need to reload.

Discussion

This method is called when the underlying data in the persistent store (may have) changed.

Declared In

OCRPackagesTableViewController.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

OCRPackagesTableViewController.m

splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:

Asks the delegate to adjust the primary view controller and to incorporate the secondary view controller into the collapsed interface.

- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController

Parameters

splitViewController

The split view controller whose interface is collapsing.

secondaryViewController

The secondary view controller of the split view interface.

primaryViewController

The primary view controller of the split view interface. If you implement the primaryViewControllerForCollapsingSplitViewController: method in your delegate, this object is the one returned by that method.

Return Value

NO to let the split view controller try and incorporate the secondary view controller’s content into the collapsed interface or YES to indicate that you do not want the split view controller to do anything with the secondary view controller.

Discussion

This method is your opportunity to perform any necessary tasks related to the transition to a collapsed interface. After this method returns, the split view controller removes the secondary view controller from its viewControllers array, leaving the primary view controller as its only child. In your implementation of this method, you might prepare the primary view controller for display in a compact environment or you might attempt to incorporate the secondary view controller’s content into the newly collapsed interface.

Returning NO tells the split view controller to use its default behavior to try and incorporate the secondary view controller into the collapsed interface. When you return NO, the split view controller calls the collapseSecondaryViewController:forSplitViewController: method of the primary view controller, giving it a chance to do something with the secondary view controller’s content. Most view controllers do nothing by default but the UINavigationController class responds by pushing the secondary view controller onto its navigation stack.

Returning YES from this method tells the split view controller not to apply any default behavior. You might return YES in cases where you do not want the secondary view controller’s content incorporated into the resulting interface.

Declared In

OCRPackagesTableViewController.m

splitViewController:shouldHideViewController:inOrientation:

Asks the delegate whether the first view controller should be hidden for the specified orientation.

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation

Parameters

svc

The split view controller that owns the first view controller.

vc

The first view controller in the array of view controllers.

orientation

The orientation being considered.

Return Value

YES if the view controller should be hidden in the specified orientation or NO if it should be visible.

Discussion

The split view controller calls this method only for the first child view controller in its array. The second view controller always remains visible regardless of the orientation.

Declared In

OCRPackagesTableViewController.m

splitViewController:willHideViewController:withBarButtonItem:forPopoverController:

Tells the delegate that the specified view controller is about to be hidden.

- (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)aPopoverController

Parameters

svc

The split view controller that owns the specified view controller.

aViewController

The view controller being hidden.

barButtonItem

A button you can add to your toolbar.

aPopoverController

The popover controller that uses taps in barButtonItem to display the specified view controller.

Discussion

When the split view controller rotates from a landscape to portrait orientation, it normally hides one of its view controllers. When that happens, it calls this method to coordinate the addition of a button to the toolbar (or navigation bar) of the remaining custom view controller. If you want the soon-to-be hidden view controller to be displayed in a popover, you must implement this method and use it to add the specified button to your interface.

Declared In

OCRPackagesTableViewController.m

splitViewController:willShowViewController:invalidatingBarButtonItem:

Tells the delegate that the specified view controller is about to be shown again.

- (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)button

Parameters

svc

The split view controller that owns the specified view controller.

aViewController

The view controller being hidden.

button

The button used to display the view controller while it was hidden.

Discussion

When the view controller rotates from a portrait to landscape orientation, it shows its hidden view controller once more. If you added the specified button to your toolbar to facilitate the display of the hidden view controller in a popover, you must implement this method and use it to remove that button.

Nil out references to the popover controller and the popover button, and tell the detail view controller to hide the button.

Declared In

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.m

tableView:willSelectRowAtIndexPath:

Tells the delegate that a specified row is about to be selected.

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath

Parameters

tableView

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

indexPath

An index path locating the new in tableView.

Return Value

An index-path object that confirms or alters the selected row. Return an NSIndexPath object other than indexPath if you want another cell to be selected. Return nil if you don’t want the row selected.

Discussion

This method is not called until users touch a row and then lift their finger; the row isn'€™t selected until then, although it is highlighted on touch-down. You can use UITableViewCellSelectionStyleNone to disable the appearance of the cell highlight on touch-down. This method isn’t called when the table view is in editing mode (that is, the editing property of the table view is set to YES) unless the table view allows selection during editing (that is, the allowsSelectionDuringEditing property of the table view is set to YES).

We do not want to allow swipe to delete, so we return nil.

Declared In

OCRPackagesTableViewController.m

userTextSizeDidChange:

Called when the user changes the size of dynamic text.

- (void)userTextSizeDidChange:(NSNotification *)aNotification

Parameters

aNotification

The notification sent with the UIContentSizeCategoryDidChangeNotification notification

Declared In

OCRPackagesTableViewController.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

OCRPackagesTableViewController.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

OCRPackagesTableViewController.m

viewWillDisappear:

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

- (void)viewWillDisappear:(BOOL)animated

Parameters

animated

If YES, the disappearance of the view is being animated.

Discussion

This method is called in response to a view being removed from a view hierarchy. This method is called before the view is actually removed and before any animations are configured.

Subclasses can override this method and use it to commit editing changes, resign the first responder status of the view, or perform other relevant tasks. For example, you might use this method to revert changes to the orientation or style of the status bar that were made in the viewDidDisappear: method when the view was first presented. If you override this method, you must call super at some point in your implementation.

Declared In

OCRPackagesTableViewController.m