SCViewController Class Reference
Inherits from | UIViewController |
Conforms to | UIPopoverControllerDelegate UISplitViewControllerDelegate |
Declared in | SCViewController.h |
Overview
This class functions as a means to simplify development with SCTableViewModel.
SCViewController conveniently provides several ready made navigation bar types based on SCNavigationBarType, provided that it is a subview of a navigation controller. ‘SCViewController’ also defines placeholders for a tableView and a tableViewModel that the user can allocate and assign. If a tableViewModel is defined, SCViewController also connects its doneButton (if present) to tableViewModel’s commitButton automatically.
In addition, SCViewController fully manages memory warnings and makes sure the assigned table view is released once a memory warning occurs and reloaded once the view controller is loaded once more.
Finally, SCViewController provides several useful actions (SCViewControllerActions) and delegate methods (SCViewControllerDelegate) that notify the delegate object of events like the view appearing or disappearing.
Note: You do NOT have to use ‘SCViewController’ in order to be able to use SCTableViewModel, but it’s highly recommended that you do so whenever you need a UIViewController.
Tasks
Configuration
-
tableView
property -
tableViewModel
property -
navigationBarType
property -
addButton
property -
editButton
property -
cancelButton
property -
allowEditingModeCancelButton
property -
doneButton
property -
popoverController
property -
actions
property -
state
property
Managing Button Events
-
cancelButtonTapped
property -
doneButtonTapped
property
Managing Contained View Controller
-
containedViewController
property
Managing Delegate
-
delegate
property
Internal Properties & Methods (should only be used by the framework or when subclassing)
Properties
actions
The set of view controller action blocks.
@property (nonatomic, readonly) SCViewControllerActions *actions
Declared In
SCViewController.h
addButton
The navigation bar’s Add button. Only contains a value if the button exists on the bar.
@property (nonatomic, readonly) UIBarButtonItem *addButton
Declared In
SCViewController.h
allowEditingModeCancelButton
Set to TRUE to allow the cancel button to appear when entering editing mode. Default: TRUE. @note: Only applicable if navigationBarType == SCNavigationBarTypeEditRight.
@property (nonatomic, readwrite) BOOL allowEditingModeCancelButton
Declared In
SCViewController.h
cancelButton
The navigation bar’s Cancel button. Only contains a value if the button exists on the bar.
@property (nonatomic, readonly) UIBarButtonItem *cancelButton
Declared In
SCViewController.h
cancelButtonTapped
Property is TRUE if the view controller have been dismissed due to the user tapping the Cancel button. This property is useful if you do not with to subclass this view controller. See also SCViewControllerDelegate to get notified when the view controller is dismissed.
@property (nonatomic, readonly) BOOL cancelButtonTapped
Declared In
SCViewController.h
containedViewController
This property is automatically set to the contained child view controller, allowing the view controller to act as a proxy for this child. When acting as a proxy, both the view controller’s tableView and tableViewModel will return the child’s instead of its own.
@property (nonatomic, weak) SCTableViewController *containedViewController
Discussion
Note: If your view controller has more than once contained view controller child, you may manually assign this property to the child of your choice.
Declared In
SCViewController.h
delegate
The object that acts as the delegate of ‘SCViewController’. The object must adopt the SCViewControllerDelegate protocol.
@property (nonatomic, weak) id delegate
Declared In
SCViewController.h
doneButton
The navigation bar’s Done button. Only contains a value if the button exists on the bar.
@property (nonatomic, readonly) UIBarButtonItem *doneButton
Declared In
SCViewController.h
doneButtonTapped
Property is TRUE if the view controller have been dismissed due to the user tapping the Done button. This property is useful if you do not with to subclass this view controller. See also SCViewControllerDelegate to get notified when the view controller is dismissed.
@property (nonatomic, readonly) BOOL doneButtonTapped
Declared In
SCViewController.h
editButton
The editButtonItem of SCViewController’s superclass.
@property (nonatomic, readonly) UIBarButtonItem *editButton
Declared In
SCViewController.h
hasFocus
Returns TRUE if the view controller currently has been given focus by its master model.
@property (nonatomic, readonly) BOOL hasFocus
Declared In
SCViewController.h
navigationBarType
The type of the navigation bar.
@property (nonatomic, readwrite) SCNavigationBarType navigationBarType
Declared In
SCViewController.h
popoverController
If the view controller is presented from within a popover controller, this property must be set to it. When set, the view controller takes over the delegate of the popover controller.
@property (nonatomic, strong) UIPopoverController *popoverController
Declared In
SCViewController.h
state
The current state of the view controller.
@property (nonatomic, readonly) SCViewControllerState state
Declared In
SCViewController.h
tableView
Set this outlet to the table view that will be associated with tableViewModel. Once a valid table view is set, it will automatically be associated with tableViewModel.
@property (nonatomic, strong) IBOutlet UITableView *tableView
Discussion
Note: If the table view is added programmatically, then the user must also add it to the view controller’s view.
Declared In
SCViewController.h
tableViewModel
Contains a valid SCTableViewModel that is associated with tableView and ready to use. If this model is replaced by a custom one, the class will automatically take care of associating it with tableView.
@property (nonatomic, strong) SCTableViewModel *tableViewModel
Declared In
SCViewController.h
Instance Methods
cancelButtonAction
Method gets called when the Cancel button is tapped. If what you want is to get notified when the Cancel button gets tapped without subclassing ‘SCViewController’, consider using SCViewControllerDelegate.
- (void)cancelButtonAction
Declared In
SCViewController.h
dismissWithCancelValue:doneValue:
Dismisses the view controller with the specified values for cancel and done.
- (void)dismissWithCancelValue:(BOOL)cancelValue doneValue:(BOOL)doneValue
Declared In
SCViewController.h
doneButtonAction
Method gets called when the Done button is tapped. If what you want is to get notified when the Cancel button gets tapped without subclassing ‘SCViewController’, consider using SCViewControllerDelegate.
- (void)doneButtonAction
Declared In
SCViewController.h
editButtonAction
Method gets called when the Edit button is tapped.
- (void)editButtonAction
Declared In
SCViewController.h
editingModeCancelButtonAction
Method gets called when the Cancel button is tapped while the table view is in editing mode.
- (void)editingModeCancelButtonAction
Declared In
SCViewController.h
gainFocus
Called by master model to have the view controller gain focus.
- (void)gainFocus
Declared In
SCViewController.h