SCArrayOfItemsModel
@interface SCArrayOfItemsModel
: SCTableViewModel <SCTableViewControllerDelegate, UISearchBarDelegate,
UISearchResultsUpdating> {
SCArrayOfItemsSection *tempSection;
NSArray *filteredArray;
SCDataStore *dataStore;
SCDataFetchOptions *dataFetchOptions;
BOOL _loadingContents;
BOOL sectionsInSync;
NSMutableArray *items;
BOOL autoFetchItems;
BOOL itemsInSync;
UITableViewCellAccessoryType itemsAccessoryType;
BOOL allowAddingItems;
BOOL allowDeletingItems;
BOOL allowMovingItems;
BOOL allowEditDetailView;
BOOL allowRowSelection;
BOOL autoSelectNewItemCell;
SCDetailViewControllerOptions *detailViewControllerOptions;
SCDetailViewControllerOptions *newItemDetailViewControllerOptions;
UISearchBar *searchBar;
}
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.
See
SCArrayOfStringsModel, SCArrayOfObjectsModel, SCArrayOfStringsSection, SCArrayOfObjectsSection.
-
Undocumented
Declaration
Objective-C
SCArrayOfItemsSection *tempSection
-
Undocumented
Declaration
Objective-C
NSArray *filteredArray
-
Undocumented
Declaration
Objective-C
SCDataStore *dataStore
-
Undocumented
Declaration
Objective-C
SCDataFetchOptions *dataFetchOptions
-
Undocumented
Declaration
Objective-C
BOOL _loadingContents
-
Undocumented
Declaration
Objective-C
BOOL sectionsInSync
-
Undocumented
Declaration
Objective-C
NSMutableArray *items
-
Undocumented
Declaration
Objective-C
BOOL autoFetchItems
-
Undocumented
Declaration
Objective-C
BOOL itemsInSync
-
Undocumented
Declaration
Objective-C
UITableViewCellAccessoryType itemsAccessoryType
-
Undocumented
Declaration
Objective-C
BOOL allowAddingItems
-
Undocumented
Declaration
Objective-C
BOOL allowDeletingItems
-
Undocumented
Declaration
Objective-C
BOOL allowMovingItems
-
Undocumented
Declaration
Objective-C
BOOL allowEditDetailView
-
Undocumented
Declaration
Objective-C
BOOL allowRowSelection
-
Undocumented
Declaration
Objective-C
BOOL autoSelectNewItemCell
-
Undocumented
Declaration
Objective-C
SCDetailViewControllerOptions *detailViewControllerOptions
-
Undocumented
Declaration
Objective-C
SCDetailViewControllerOptions *newItemDetailViewControllerOptions
-
Undocumented
Declaration
Objective-C
UISearchBar *searchBar
-
Returns an initialized ‘SCArrayOfItemsModel given a UITableView and a data store.
Declaration
Objective-C
- (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.
-
The data store that’s used to store and fetch the model’s items.
Declaration
Objective-C
@property (nonatomic, strong) SCDataStore *dataStore;
-
The options used to fetch the model’s items from dataStore.
Declaration
Objective-C
@property (nonatomic, strong) SCDataFetchOptions *dataFetchOptions;
-
The items fetched from dataStore.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray *items;
-
Set to FALSE to disable the section from automatically fetching its items from dataStore. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL autoFetchItems;
-
The accessory type of the generated cells.
Declaration
Objective-C
@property (nonatomic) UITableViewCellAccessoryType itemsAccessoryType;
-
Allows/disables adding new cells/items to the items array. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL allowAddingItems;
-
Allows/disables deleting new cells/items from the items array. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL allowDeletingItems;
-
Allows/disables moving cells/items from one row to another. Default: FALSE.
Declaration
Objective-C
@property (nonatomic) BOOL allowMovingItems;
-
Allows/disables a detail view for editing items’ values. Default: TRUE.
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.
Declaration
Objective-C
@property (nonatomic) BOOL allowEditDetailView;
-
Allows/disables row selection. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL allowRowSelection;
-
Allows/disables automatic cell selection of newly created items. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL autoSelectNewItemCell;
-
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.
Declaration
Objective-C
@property (nonatomic, strong) UIBarButtonItem *addButtonItem;
-
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.
Declaration
Objective-C
@property (nonatomic, strong) UISearchBar *searchBar;
-
Set to TRUE to use a search controller to perform searches. Default: FALSE.
Declaration
Objective-C
@property (nonatomic) BOOL enableSearchController;
-
The search controller used to search the model values.
@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.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UISearchController *searchController;
-
Options for the generated detail view controller.
Declaration
Objective-C
@property (nonatomic, readonly) SCDetailViewControllerOptions *detailViewControllerOptions;
-
Options for the generated detail view controller for new items.
Declaration
Objective-C
@property (nonatomic, readonly) SCDetailViewControllerOptions *newItemDetailViewControllerOptions;
-
User can call this method to dispatch an AddNewItem event, the same event dispached when the end-user taps addButtonItem.
Declaration
Objective-C
- (void)dispatchEventAddNewItem;
-
User can call this method to dispatch a SelectRow event, the same event dispached when the end-user selects a cell.
Declaration
Objective-C
- (void)dispatchEventSelectRowAtIndexPath:(NSIndexPath *)indexPath;
-
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.
Declaration
Objective-C
- (void)dispatchEventRemoveRowAtIndexPath:(NSIndexPath *)indexPath;
-
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
Declaration
Objective-C
@property (nonatomic, copy) NSString *ibNewItemViewControllerIdentifier;
-
Undocumented
Declaration
Objective-C
- (void)configureUsingSection:(SCArrayOfItemsSection *)section;
-
Undocumented
Declaration
Objective-C
- (NSMutableArray *)mutableItems;
-
Undocumented
Declaration
Objective-C
- (void)setMutableItems:(NSMutableArray *)mutableItems;
-
Subclasses should override this method to handle section creation.
Declaration
Objective-C
- (SCArrayOfItemsSection *)createSectionWithHeaderTitle:(NSString *)title;
-
Subclasses should override this method to set additional section properties after creation.
Declaration
Objective-C
- (void)setPropertiesForSection:(SCArrayOfItemsSection *)section;
-
Subclasses should override this method to handle when addButtonItem is tapped.
Declaration
Objective-C
- (void)didTapAddButtonItem;
-
Method called internally by framework when the model should add a new item.
Declaration
Objective-C
- (void)addNewItem:(NSObject *)newItem;
-
Method called internally by framework when a model item has been modified.
Declaration
Objective-C
- (void)itemModified:(NSObject *)item inSection:(SCArrayOfItemsSection *)section;
-
Method called internally by framework when a model item has been removed.
Declaration
Objective-C
- (void)itemRemoved:(NSObject *)item inSection:(SCArrayOfItemsSection *)section;
-
Method called internally by framework when the model’s items are out of sync with the data store.
Declaration
Objective-C
- (void)invalidateItems;
-
Method called internally by framework.
Declaration
Objective-C
- (NSUInteger)getSectionIndexForItem:(NSObject *)item;