SCTableViewController Class Reference
Inherits from | UITableViewController |
Conforms to | UIPopoverControllerDelegate UISplitViewControllerDelegate |
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) that notify the delegate object of events like the view appearing or disappearing.
Tasks
Configuration
-
tableViewModel
property -
navigationBarType
property -
addButton
property -
editButton
property -
cancelButton
property -
allowEditingModeCancelButton
property -
doneButton
property -
autoDisableNavigationButtonsUntilViewAppears
property -
popoverController
property -
actions
property -
state
property
Managing Button Events
-
cancelButtonTapped
property -
doneButtonTapped
property
Interface Builder Related
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) 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
autoDisableNavigationButtonsUntilViewAppears
When set to YES, the view controller will automatically disable all navigation bar buttons until its view fully appears. This setting is inhereted by all automatically generated detail view controllers. Default: NO.
@property (nonatomic, readwrite) BOOL autoDisableNavigationButtonsUntilViewAppears
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, weak) 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
addStaticContentToModel
Method used internally to add all static content added in IB to the table view model.
- (void)addStaticContentToModel
Declared In
SCTableViewController.h
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
dataDefinitionWithIBName:
Method returns the Interface Builder data definition with the given name.
- (SCDataDefinition *)dataDefinitionWithIBName:(NSString *)ibName
Parameters
- ibName
The name of the data definition. This name is typically found in IB’s document outline pane.
Return Value
The data definition.
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
loseFocus
Called by master model to have the view controller lose focus.
- (void)loseFocus
Declared In
SCTableViewController.h
objectForSection:atIndex:
This method should be implemented by SCTableViewController subclasses that wish to provide data source object to an SCObjectSection that has been created in Interface Builder.
- (NSObject *)objectForSection:(SCObjectSection *)objectSection atIndex:(NSUInteger)index
Parameters
- objectSection
The object section that needs the data source object.
- index
The object section index.
Return Value
An object compatible with objectSection’s data definition.
Discussion
Note: There is no need to implement this method for sections with data definitions of type SCUserDefaultsDefinition or SCiCloudKeyValueDefinition.
Declared In
SCTableViewController.h
objectsForSection:atIndex:
This method should be implemented by SCTableViewController subclasses that wish to provide data source objects to an SCArrayOfObjectsSection that has been created in Interface Builder. The method is typically called by the STV framework for sections with data definitions of type SCClassDefinition or SCDictionaryDefinition.
- (NSMutableArray *)objectsForSection:(SCArrayOfObjectsSection *)objectsSection atIndex:(NSUInteger)index
Parameters
- objectsSection
The objects section that needs the data source objects.
- index
The objects section index.
Return Value
A mutable array of objects compatible with objectsSection’s data definition.
Discussion
Note: There is no need to implement this method for sections with data definitions of type SCEntityDefinition or SCWebServiceDefinition.
Declared In
SCTableViewController.h