SCObjectSelectionModel Class Reference
Inherits from | SCArrayOfObjectsModel : SCArrayOfItemsModel : SCTableViewModel : NSObject |
Declared in | SCTableViewModel.h |
Overview
This class functions as a model that provides the end-user with an automatically generated list of objects to choose from.
The selection items are provided in the form of an array of NSObjects, called the items array. ‘SCObjectSelectionModel’ can be configured to allow multiple selection and to allow no selection at all. If allow multiple selection is disabled, then the bound property name of this model must be of type NSObject, otherwise it must be of type NSMutableSet.
Tasks
Creation and Initialization
-
– initWithTableView:boundObject:selectedObjectPropertyName:selectionItemsStore:
Returns an initialized ‘SCObjectSelectionModel’ given a table view, bound object, a bound property name, and a selection items store.
-
– initWithTableView:boundObject:selectedObjectPropertyName:items:itemsDefintion:
Returns an initialized ‘SCObjectSelectionModel’ given a table view, bound object, a bound property name, and an array of selection items.
Configuration
-
boundObject
The model’s bound object.
property -
boundObjectStore
The model’s bound object store.
property -
boundPropertyName
The model’s bound property name.
property -
boundValue
The model’s bound value.
property -
selectedItemIndex
This property reflects the current model selection. You can set this property to define the model’s selection.
property -
selectedItemsIndexes
This property reflects the current model selection(s). You can add index(es) to the set to define the section’s selection.
property -
allowMultipleSelection
If TRUE, the model allows multiple selection. Default: FALSE.
property -
allowNoSelection
If TRUE, the model allows no selection at all. Default: FALSE.
property -
maximumSelections
The maximum number of items that can be selected. Set to zero to allow an infinite number of selections. Default: 0.
property -
autoDismissViewController
If TRUE, the model automatically dismisses the current view controller when a value is selected. Default: FALSE.
property
Properties
allowMultipleSelection
If TRUE, the model allows multiple selection. Default: FALSE.
@property (nonatomic, readwrite) BOOL allowMultipleSelection
Declared In
SCTableViewModel.h
allowNoSelection
If TRUE, the model allows no selection at all. Default: FALSE.
@property (nonatomic, readwrite) BOOL allowNoSelection
Declared In
SCTableViewModel.h
autoDismissViewController
If TRUE, the model automatically dismisses the current view controller when a value is selected. Default: FALSE.
@property (nonatomic, readwrite) BOOL autoDismissViewController
Declared In
SCTableViewModel.h
boundObject
The model’s bound object.
@property (nonatomic, strong) NSObject *boundObject
Declared In
SCTableViewModel.h
boundObjectStore
The model’s bound object store.
@property (nonatomic, strong) SCDataStore *boundObjectStore
Declared In
SCTableViewModel.h
boundPropertyName
The model’s bound property name.
@property (nonatomic, copy) NSString *boundPropertyName
Declared In
SCTableViewModel.h
boundValue
The model’s bound value.
@property (nonatomic, strong) NSObject *boundValue
Declared In
SCTableViewModel.h
maximumSelections
The maximum number of items that can be selected. Set to zero to allow an infinite number of selections. Default: 0.
@property (nonatomic, readwrite) NSUInteger maximumSelections
Discussion
Note: Only applicable when allowMultipleSelection is TRUE.
Declared In
SCTableViewModel.h
selectedItemIndex
This property reflects the current model selection. You can set this property to define the model’s selection.
@property (nonatomic, copy) NSNumber *selectedItemIndex
Discussion
Note: In case of no selection, this property will be set to an NSNumber of value -1.
Declared In
SCTableViewModel.h
Instance Methods
initWithTableView:boundObject:selectedObjectPropertyName:items:itemsDefintion:
Returns an initialized ‘SCObjectSelectionModel’ given a table view, bound object, a bound property name, and an array of selection items.
- (id)initWithTableView:(UITableView *)tableView boundObject:(NSObject *)object selectedObjectPropertyName:(NSString *)propertyName items:(NSArray *)selectionItems itemsDefintion:(SCDataDefinition *)definition
Parameters
- tableView
The model’s table view.
- object
The object the model will bind to.
- propertyName
The model’s bound property name corresponding to the object selection. If multiple selection is allowed, then property must be of an NSMutableSet type, otherwise, property must be of type NSObject and cannot be a readonly property.
- selectionItems
An array of the items that the user will choose from. All items must be of an NSObject type and all items must be instances of the same class.
- definition
The definition of the selection items.
Declared In
SCTableViewModel.h
initWithTableView:boundObject:selectedObjectPropertyName:selectionItemsStore:
Returns an initialized ‘SCObjectSelectionModel’ given a table view, bound object, a bound property name, and a selection items store.
- (id)initWithTableView:(UITableView *)tableView boundObject:(NSObject *)object selectedObjectPropertyName:(NSString *)propertyName selectionItemsStore:(SCDataStore *)store
Parameters
- tableView
The model’s table view.
- object
The object the model will bind to.
- propertyName
The model’s bound property name corresponding to the object selection. If multiple selection is allowed, then property must be of an NSMutableSet type, otherwise, property must be of type NSObject and cannot be a readonly property.
- store
The store containing the selection objects.
Declared In
SCTableViewModel.h