SCTableViewController Class Reference
Inherits from | UITableViewController |
Conforms to | UIPopoverControllerDelegate |
Declared in | SCTableViewController.h |
Overview
This class functions as a means to simplify development with SCTableViewModel.
SCTableViewController conveniently provides several ready made navigation bar types based on SCNavigationBarType, provided that it is a subview of a navigation controller. SCTableViewController also defines placeholders for a tableView and a tableViewModel that the user can allocate and assign. If a tableViewModel is defined, SCTableViewController also connects its doneButton (if present) to tableViewModel’s commitButton automatically.
In addition, SCTableViewController 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, SCTableViewController provides several useful actions (SCTableViewControllerActions) and delegate methods (SCTableViewControllerDelegate) that notify the delegate object of events like the view appearing or disappearing.
Note: You do NOT have to use SCTableViewController in order to be able to use SCTableViewModel, but it’s highly recommended that you do so whenever you need a UITableViewController.
Tasks
Configuration
-
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 -
navigationBarType
The type of the navigation bar.
property -
addButton
The navigation bar’s Add button. Only contains a value if the button exists on the bar.
property -
editButton
The editButtonItem of ‘SCTableViewController’’s superclass.
property -
cancelButton
The navigation bar’s Cancel button. Only contains a value if the button exists on the bar.
property -
allowEditingModeCancelButton
Set to TRUE to allow the cancel button to appear when entering editing mode. Default: TRUE. @note: Only applicable if navigationBarType == SCNavigationBarTypeEditRight.
property -
doneButton
The navigation bar’s Done button. Only contains a value if the button exists on the bar.
property -
buttonsToolbar
The toolbar that holds more than one button when needed (e.g. when navigationBarType==SCNavigationBarTypeAddEditRight).
property -
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 -
actions
The set of view controller action blocks.
property -
state
The current state of the view controller.
property
Managing Button Events
-
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 SCTableViewControllerDelegate to get notified when the view controller is dismissed.
property -
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 SCTableViewControllerDelegate to get notified when the view controller is dismissed.
property
Managing Delegate
-
delegate
The object that acts as the delegate of ‘SCTableViewController’. The object must adopt the SCTableViewControllerDelegate protocol.
property
Internal Properties & Methods (should only be used by the framework or when subclassing)
-
hasFocus
Returns TRUE if the view controller currently has been given focus by its master model.
property -
– performInitialization
Method should be overridden by subclasses to perform any required initialization.
-
– 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 ‘SCTableViewController’, consider using SCTableViewControllerDelegate.
-
– 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 ‘SCTableViewController’, consider using SCTableViewControllerDelegate.
-
– editButtonAction
Method gets called when the Edit button is tapped.
-
– editingModeCancelButtonAction
Method gets called when the Cancel button is tapped while the table view is in editing mode.
-
– dismissWithCancelValue:doneValue:
Dismisses the view controller with the specified values for cancel and done.
-
– gainFocus
Called by master model to have the view controller gain focus.
-
– loseFocus
Called by master model to have the view controller lose focus.
Properties
actions
The set of view controller action blocks.
@property (nonatomic, readonly) SCTableViewControllerActions *actions
Declared In
SCTableViewController.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
SCTableViewController.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
SCTableViewController.h
buttonsToolbar
The toolbar that holds more than one button when needed (e.g. when navigationBarType==SCNavigationBarTypeAddEditRight).
@property (nonatomic, readonly) UIToolbar *buttonsToolbar
Declared In
SCTableViewController.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
SCTableViewController.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 SCTableViewControllerDelegate to get notified when the view controller is dismissed.
@property (nonatomic, readonly) BOOL cancelButtonTapped
Declared In
SCTableViewController.h
delegate
The object that acts as the delegate of ‘SCTableViewController’. The object must adopt the SCTableViewControllerDelegate protocol.
@property (nonatomic, unsafe_unretained) id delegate
Declared In
SCTableViewController.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
SCTableViewController.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 SCTableViewControllerDelegate to get notified when the view controller is dismissed.
@property (nonatomic, readonly) BOOL doneButtonTapped
Declared In
SCTableViewController.h
editButton
The editButtonItem of ‘SCTableViewController’’s superclass.
@property (nonatomic, readonly) UIBarButtonItem *editButton
Declared In
SCTableViewController.h
hasFocus
Returns TRUE if the view controller currently has been given focus by its master model.
@property (nonatomic, readonly) BOOL hasFocus
Declared In
SCTableViewController.h
navigationBarType
The type of the navigation bar.
@property (nonatomic, readwrite) SCNavigationBarType navigationBarType
Declared In
SCTableViewController.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
SCTableViewController.h
state
The current state of the view controller.
@property (nonatomic, readonly) SCViewControllerState state
Declared In
SCTableViewController.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
SCTableViewController.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 ‘SCTableViewController’, consider using SCTableViewControllerDelegate.
- (void)cancelButtonAction
Declared In
SCTableViewController.h
dismissWithCancelValue:doneValue:
Dismisses the view controller with the specified values for cancel and done.
- (void)dismissWithCancelValue:(BOOL)cancelValue doneValue:(BOOL)doneValue
Declared In
SCTableViewController.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 ‘SCTableViewController’, consider using SCTableViewControllerDelegate.
- (void)doneButtonAction
Declared In
SCTableViewController.h
editButtonAction
Method gets called when the Edit button is tapped.
- (void)editButtonAction
Declared In
SCTableViewController.h
editingModeCancelButtonAction
Method gets called when the Cancel button is tapped while the table view is in editing mode.
- (void)editingModeCancelButtonAction
Declared In
SCTableViewController.h
gainFocus
Called by master model to have the view controller gain focus.
- (void)gainFocus
Declared In
SCTableViewController.h