SCArrayOfItemsModel Class Reference
Inherits from | SCTableViewModel : NSObject |
Conforms to | SCTableViewControllerDelegate UISearchBarDelegate UISearchResultsUpdating |
Declared in | SCTableViewModel.h |
Overview
This class subclasses SCTableViewModel to represent an array of any kind of items and will automatically generate its cells from these items. ‘SCArrayOfItemsModel will automatically generate a set of SCArrayOfItemsSection(s) if the sectionHeaderTitleForItem modelAction is implemented, otherwise it will only generate a single SCArrayOfItemsSection.
Warning: This is an abstract base class, you should never make any direct instances of it.
Tasks
Creation and Initialization
Configuration
-
dataStore
property -
dataFetchOptions
property -
items
property -
autoFetchItems
property -
itemsAccessoryType
property -
allowAddingItems
property -
allowDeletingItems
property -
allowMovingItems
property -
allowEditDetailView
property -
allowRowSelection
property -
autoSelectNewItemCell
property -
addButtonItem
property -
searchBar
property -
enableSearchController
property -
searchController
property -
searchDisplayController
property -
detailViewControllerOptions
property -
newItemDetailViewControllerOptions
property
Manual Event Control
Internal Properties & Methods (should only be used by the framework or when subclassing)
Properties
addButtonItem
Set this property to a valid UIBarButtonItem. When addButtonItem is tapped and allowAddingItems is TRUE, a detail view is automatically generated for the user to enter the new items properties. If the properties are commited, a new item is added to the array.
@property (nonatomic, strong) UIBarButtonItem *addButtonItem
Declared In
SCTableViewModel.h
allowAddingItems
@property (nonatomic, readwrite) BOOL allowAddingItems
Declared In
SCTableViewModel.h
allowDeletingItems
@property (nonatomic, readwrite) BOOL allowDeletingItems
Declared In
SCTableViewModel.h
allowEditDetailView
Allows/disables a detail view for editing items' values. Default: TRUE.
@property (nonatomic, readwrite) BOOL allowEditDetailView
Discussion
Detail views are automatically generated for editing new items. You can control wether the view appears as a modal view or gets pushed to the navigation stack using the detailViewModal property. Modal views have the added feature of giving the end user a Cancel and Done buttons. The Cancel button cancels all user’s actions, while the Done button commits them. Also, if the cell’s validation is enabled, the Done button will remain disabled until all cells' values are valid.
Declared In
SCTableViewModel.h
allowMovingItems
Allows/disables moving cells/items from one row to another. Default: FALSE.
@property (nonatomic, readwrite) BOOL allowMovingItems
Declared In
SCTableViewModel.h
allowRowSelection
Allows/disables row selection. Default: TRUE.
@property (nonatomic, readwrite) BOOL allowRowSelection
Declared In
SCTableViewModel.h
autoFetchItems
Set to FALSE to disable the section from automatically fetching its items from dataStore. Default: TRUE.
@property (nonatomic, readwrite) BOOL autoFetchItems
Declared In
SCTableViewModel.h
autoSelectNewItemCell
Allows/disables automatic cell selection of newly created items. Default: TRUE.
@property (nonatomic, readwrite) BOOL autoSelectNewItemCell
Declared In
SCTableViewModel.h
dataFetchOptions
@property (nonatomic, strong) SCDataFetchOptions *dataFetchOptions
Declared In
SCTableViewModel.h
dataStore
The data store that’s used to store and fetch the model’s items.
@property (nonatomic, strong) SCDataStore *dataStore
Declared In
SCTableViewModel.h
detailViewControllerOptions
Options for the generated detail view controller.
@property (nonatomic, readonly) SCDetailViewControllerOptions *detailViewControllerOptions
Declared In
SCTableViewModel.h
enableSearchController
Set to TRUE to use a search controller to perform searches. Default: FALSE.
@property (nonatomic, readwrite) BOOL enableSearchController
Declared In
SCTableViewModel.h
items
The items fetched from dataStore.
@property (nonatomic, readonly) NSArray *items
Declared In
SCTableViewModel.h
itemsAccessoryType
The accessory type of the generated cells.
@property (nonatomic, readwrite) UITableViewCellAccessoryType itemsAccessoryType
Declared In
SCTableViewModel.h
newItemDetailViewControllerOptions
Options for the generated detail view controller for new items.
@property (nonatomic, readonly) SCDetailViewControllerOptions *newItemDetailViewControllerOptions
Declared In
SCTableViewModel.h
searchBar
The search bar associated with the model. Once set to a valid UISearchBar, the model will automatically filter its items based on the user’s typed search term.
@property (nonatomic, strong) UISearchBar *searchBar
Declared In
SCTableViewModel.h
searchController
The search controller used to search the model values.
@property (nonatomic, strong, readonly) UISearchController *searchController
Discussion
@note: searchController only has value if enableSearchController is TRUE. @note: IMPORTANT: At runtime, if the device is running iOS 7.0, searchDisplayController will be used instead.
Declared In
SCTableViewModel.h
searchDisplayController
The search controller used to search the model values.
@property (nonatomic, strong, readonly) UISearchDisplayController *searchDisplayController
Discussion
@note: searchDisplayController only has value if enableSearchController is TRUE. @note: IMPORTANT: If your deployment target is iOS 8.0 or later, use searchController instead.
Declared In
SCTableViewModel.h
Instance Methods
addNewItem:
Method called internally by framework when the model should add a new item.
- (void)addNewItem:(NSObject *)newItem
Declared In
SCTableViewModel.h
createSectionWithHeaderTitle:
Subclasses should override this method to handle section creation.
- (SCArrayOfItemsSection *)createSectionWithHeaderTitle:(NSString *)title
Declared In
SCTableViewModel.h
didTapAddButtonItem
Subclasses should override this method to handle when addButtonItem is tapped.
- (void)didTapAddButtonItem
Declared In
SCTableViewModel.h
dispatchEventAddNewItem
User can call this method to dispatch an AddNewItem event, the same event dispached when the end-user taps addButtonItem.
- (void)dispatchEventAddNewItem
Declared In
SCTableViewModel.h
dispatchEventRemoveRowAtIndexPath:
User can call this method to dispatch a RemoveRow event, the same event dispached when the end-user taps the delete button on a cell.
- (void)dispatchEventRemoveRowAtIndexPath:(NSIndexPath *)indexPath
Declared In
SCTableViewModel.h
dispatchEventSelectRowAtIndexPath:
User can call this method to dispatch a SelectRow event, the same event dispached when the end-user selects a cell.
- (void)dispatchEventSelectRowAtIndexPath:(NSIndexPath *)indexPath
Declared In
SCTableViewModel.h
getSectionIndexForItem:
Method called internally by framework.
- (NSUInteger)getSectionIndexForItem:(NSObject *)item
Declared In
SCTableViewModel.h
initWithTableView:dataStore:
Returns an initialized ‘SCArrayOfItemsModel given a UITableView and a data store.
- (instancetype)initWithTableView:(UITableView *)tableView dataStore:(SCDataStore *)store
Parameters
- tableView
The UITableView to be bound to the model.
- store
The data store containing the model’s items.
Declared In
SCTableViewModel.h
invalidateItems
Method called internally by framework when the model’s items are out of sync with the data store.
- (void)invalidateItems
Declared In
SCTableViewModel.h
itemModified:inSection:
Method called internally by framework when a model item has been modified.
- (void)itemModified:(NSObject *)item inSection:(SCArrayOfItemsSection *)section
Declared In
SCTableViewModel.h
itemRemoved:inSection:
Method called internally by framework when a model item has been removed.
- (void)itemRemoved:(NSObject *)item inSection:(SCArrayOfItemsSection *)section
Declared In
SCTableViewModel.h
setDetailViewControllerOptions:
Method called internally.
- (void)setDetailViewControllerOptions:(SCDetailViewControllerOptions *)options
Declared In
SCTableViewModel.h