Inherits from SCArrayOfStringsSection : SCArrayOfObjectsSection : SCArrayOfItemsSection : SCTableViewSection : NSObject
Declared in SCTableViewSection.h

Overview

This class functions as an SCTableViewModel section that is able to provide selection functionality. The cells in this section represent different items that the end-user can select from, and they are generated from NSStrings in its items array. Once a cell is selected, a checkmark appears next to it, similar to Apple’s Settings application where a user selects a Ringtone for their iPhone. The section can be configured to allow multiple selection and to allow no selection at all.

There are three ways to set/retrieve the section’s selection: - Through binding an object to the section, and specifying a property name to bind the selection index result to. The bound property must be of type NSMutableSet if multiple selection is allowed, otherwise it must be of type NSNumber or NSString. - Through binding a key to the section and setting/retrieving through the ownerTableViewModel modelKeyValues property. - Through the selectedItemsIndexes or selectedItemIndex properties.

Properties

allowMultipleSelection

If TRUE, the section allows multiple selection. Default: FALSE.

@property (nonatomic, readwrite) BOOL allowMultipleSelection

Declared In

SCTableViewSection.h

allowNoSelection

If TRUE, the section allows no selection at all. Default: FALSE.

@property (nonatomic, readwrite) BOOL allowNoSelection

Declared In

SCTableViewSection.h

autoDismissViewController

If TRUE, the section automatically dismisses the current view controller when a value is selected. Default: FALSE.

@property (nonatomic, readwrite) BOOL autoDismissViewController

Declared In

SCTableViewSection.h

deselectedCellTextColor

The text color of the deselected cell(s).

@property (nonatomic, strong) UIColor *deselectedCellTextColor

Declared In

SCTableViewSection.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

SCTableViewSection.h

selectedCellTextColor

The text color of the selected cell(s).

@property (nonatomic, strong) UIColor *selectedCellTextColor

Declared In

SCTableViewSection.h

selectedItemIndex

This property reflects the current section’s selection. You can set this property to define the section’s selection.

@property (nonatomic, copy) NSNumber *selectedItemIndex

Discussion

Note: If you have bound this section to an object or a key, you can define the section’s selection using either the bound property value or the key value, respectively.

Note: In case of no selection, this property will be set to an NSNumber of value -1.

Declared In

SCTableViewSection.h

selectedItemsIndexes

This property reflects the current section’s selection(s). You can add index(es) to the set to define the section’s selection.

@property (nonatomic, readonly) NSMutableSet *selectedItemsIndexes

Discussion

Note: If you have bound this section to an object or a key, you can define the section’s selection using either the bound property value or the key value, respectively.

Declared In

SCTableViewSection.h

Class Methods

sectionWithHeaderTitle:boundObject:selectedIndexPropertyName:items:

Allocates and returns an initialized ‘SCSelectionSection’ given a header title, a bound object, an NSNumber bound property name, and an array of selection items.

+ (instancetype)sectionWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectedIndexPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection. This property must be of type NSNumber and can’t be a readonly property. The section will also initialize its selection from the value present in this property.

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

Declared In

SCTableViewSection.h

sectionWithHeaderTitle:boundObject:selectedIndexesPropertyName:items:allowMultipleSelection:

Allocates and returns an initialized ‘SCSelectionSection’ given a header title, a bound object, an NSMutableSet bound property name, an array of selection items, and wether to allow multiple selection.

+ (instancetype)sectionWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectedIndexesPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems allowMultipleSelection:(BOOL)multipleSelection

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection(s). This property must be of type NSMutableSet. The section will also initialize its selection(s) from the value present in this property.

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

multipleSelection

Determines if multiple selection is allowed.

Declared In

SCTableViewSection.h

sectionWithHeaderTitle:boundObject:selectionStringPropertyName:items:

Allocates and returns an initialized ‘SCSelectionSection’ given a header title, a bound object, an NSString bound property name, and an array of selection items.

+ (instancetype)sectionWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectionStringPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection. This property must be of type NSString and can’t be a readonly property. The section will also initialize its selection from the value present in this property.

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

Declared In

SCTableViewSection.h

Instance Methods

initWithHeaderTitle:boundObject:selectedIndexPropertyName:items:

Returns an initialized ‘SCSelectionSection’ given a header title, a bound object, an NSNumber bound property name, and an array of selection items.

- (instancetype)initWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectedIndexPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection. This property must be of type NSNumber and can’t be a readonly property. The section will also initialize its selection from the value present in this property.

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

Declared In

SCTableViewSection.h

initWithHeaderTitle:boundObject:selectedIndexesPropertyName:items:allowMultipleSelection:

Returns an initialized ‘SCSelectionSection’ given a header title, a bound object, a bound property name, an array of selection items, and wether to allow multiple selection.

- (instancetype)initWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectedIndexesPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems allowMultipleSelection:(BOOL)multipleSelection

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection(s). This property must be of type NSMutableSet. The section will also initialize its selection(s) from the value present in this property. Every item in this set must be an NSNumber that represent the index of the selected cell(s).

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

multipleSelection

Determines if multiple selection is allowed.

Declared In

SCTableViewSection.h

initWithHeaderTitle:boundObject:selectionStringPropertyName:items:

Returns an initialized ‘SCSelectionSection’ given a header title, a bound object, an NSString bound property name, and an array of selection items.

- (instancetype)initWithHeaderTitle:(NSString *)sectionHeaderTitle boundObject:(NSObject *)object selectionStringPropertyName:(NSString *)propertyName items:(NSArray *)sectionItems

Parameters

sectionHeaderTitle

A header title for the section.

object

The object the section will bind to.

propertyName

The property name present in the bound object that the section will bind to and will automatically change the value of to reflect the section’s current selection. This property must be of type NSString and can’t be a readonly property. The section will also initialize its selection from the value present in this property.

sectionItems

An array of the items that the user will choose from. All items must be of an NSString type.

Declared In

SCTableViewSection.h