SCTableViewCell

@interface SCTableViewCell : UITableViewCell <SCViewControllerDelegate,
                                              SCTableViewControllerDelegate> {
  NSString *reuseId;
  BOOL configured;
  SCTableViewModel *activeDetailModel;
  SCTableViewModel *ownerTableViewModel;
  SCTableViewSection *ownerSection;
  id ownerViewControllerDelegate;
  SCDataType boundPropertyDataType;
  BOOL _isCustomBoundProperty;
  CGFloat _height;
  BOOL editable;
  BOOL movable;
  BOOL selectable;
  BOOL enabled;
  BOOL autoDeselect;
  BOOL autoResignFirstResponder;
  UITableViewCellEditingStyle cellEditingStyle;
  SCBadgeView *badgeView;
  BOOL leadingSwipePerformsFirstActionWithFullSwipe;
  BOOL trailingSwipePerformsFirstActionWithFullSwipe;
  NSArray *detailCellsImageViews;
  BOOL valueRequired;
  BOOL autoValidateValue;
  BOOL commitChangesLive;
  BOOL needsCommit;
  BOOL beingReused;
  BOOL customCell;
  BOOL isSpecialCell;
  SCDetailViewControllerOptions *detailViewControllerOptions;
  NSString *themeStyle;
}

This class functions as a cell for SCTableViewSection. SCTableViewCell is extensively subclassed to create cells with special controls such as UITextField and UISlider.

SCTableViewCell provides the user with the infrastructure to access the cell’s value using the Bound Object method. This works by binding the cell to an object, called the bound object, and to a property of this object, called the bound property. The cell initializes its value from the value of the bound property, and when its values changes, it sets the property back automatically.

Please note that even though a cell value is not applicable to SCTableViewCell itself, SCTableViewCell still provides the bound object functionality as a framework to all its subclasses to use.

Creation and Initialization

  • Allocates and returns an initialized SCTableViewCell.

    Declaration

    Objective-C

    + (instancetype)cell;
  • Allocates and returns an initialized SCTableViewCell given the cell’s style.

    Declaration

    Objective-C

    + (instancetype)cellWithStyle:(UITableViewCellStyle)style;
  • Allocates and returns an initialized SCTableViewCell given cell text.

    • - parameter: cellText The text that will appear in the cell’s textLabel.

    Declaration

    Objective-C

    + (instancetype)cellWithText:(NSString *)cellText;
  • Allocates and returns an initialized SCTableViewCell given cell text and its alignment.

    • - parameter: cellText The text that will appear in the cell’s textLabel.
    • - parameter: textAlignment The alignment setting for the cell’s text.

    Declaration

    Objective-C

    + (instancetype)cellWithText:(NSString *)cellText
                   textAlignment:(NSTextAlignment)textAlignment;
  • Allocates and returns an initialized SCTableViewCell given cell text, bound object, and a bound property name.

    • - parameter: cellText The text that will appear in the cell’s textLabel.
    • - parameter: object The cell’s bound object (see class overview).
    • - parameter: propertyName The cell’s bound property name (see class overview).

    Declaration

    Objective-C

    + (instancetype)cellWithText:(NSString *)cellText
                     boundObject:(NSObject *)object
               boundPropertyName:(NSString *)propertyName;
  • Returns an initialized SCTableViewCell given cell text.

    • - parameter: cellText The text that will appear in the cell’s textLabel.

    Declaration

    Objective-C

    - (instancetype)initWithText:(NSString *)cellText;
  • Returns an initialized SCTableViewCell given cell text and its alignment.

    • - parameter: cellText The text that will appear in the cell’s textLabel.
    • - parameter: textAlignment The alignment setting for the cell’s text.

    Declaration

    Objective-C

    - (instancetype)initWithText:(NSString *)cellText
                   textAlignment:(NSTextAlignment)textAlignment;
  • Returns an initialized SCTableViewCell given cell text, bound object, and a bound property name.

    • - parameter: cellText The text that will appear in the cell’s textLabel.
    • - parameter: object The cell’s bound object (see class overview).
    • - parameter: propertyName The cell’s bound property name (see class overview).

    Declaration

    Objective-C

    - (instancetype)initWithText:(NSString *)cellText
                     boundObject:(NSObject *)object
               boundPropertyName:(NSString *)propertyName;

Configuration

  • The owner table view model of the cell. *

    • - warning: This property gets set automatically by the framework, you should never set this property manually

    Declaration

    Objective-C

    @property (nonatomic, weak) SCTableViewModel *ownerTableViewModel;
  • The owner section of the cell. *

    • - warning: This property gets set automatically by the framework, you should never set this property manually

    Declaration

    Objective-C

    @property (nonatomic, weak) SCTableViewSection *ownerSection;
  • The set of cell action blocks.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCCellActions *cellActions;
  • The cell’s bound object (see class overview).

    Declaration

    Objective-C

    @property (nonatomic, strong) NSObject *boundObject;
  • The data store of the cell’s bound object.

    Declaration

    Objective-C

    @property (nonatomic, strong) SCDataStore *boundObjectStore;
  • The cell’s bound property name (see class overview).

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *boundPropertyName;
  • The height of the cell. Default: UITableViewAutomaticDimension.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat height;
  • The editable state of the cell. Default: FALSE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL editable;
  • The movable state of the cell. Default: FALSE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL movable;
  • Determines if the cell can be selected. Default: TRUE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL selectable;
  • Set to FALSE to disable the cell’s functionality. Usefull in situations where the cell should only be enabled in ‘Editing Mode’ for example. Default: TRUE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL enabled;
  • The color to be used for text elements when the cell’s enabled property is set to FALSE. Default: black color.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *disabledTextColor;
  • The cell style.

    Declaration

    Objective-C

    @property (nonatomic, readonly) UITableViewCellStyle cellStyle;
  • The cell’s badge view. When assigned a text value, the badgeView displays a badge similar to the badge displayed by the iPhone’s mail application for its mail folders.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCBadgeView *badgeView;
  • When this property is set to YES, a full leading swipe in the cell row performs the first UIContextualAction listed in the actions property. In a left-to-right language environment that is when the user swipes from left to right. The default value of this property is YES.

    Warning

    Only available in iOS 11 and later.

    Declaration

    Objective-C

    @property (nonatomic) BOOL leadingSwipePerformsFirstActionWithFullSwipe;
  • When this property is set to YES, a full trailing swipe in the cell row performs the first UIContextualAction listed in the actions property. In a left-to-right language environment that is when the user swipes from right to left. The default value of this property is YES.

    Warning

    Only available in iOS 11 and later.

    Declaration

    Objective-C

    @property (nonatomic) BOOL trailingSwipePerformsFirstActionWithFullSwipe;
  • Set this property to an array of UIImageView objects to be set to each of the cell’s detail cells.

    • - note: Only applicable to cells with detail views.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSArray *detailCellsImageViews;
  • If property is TRUE, the cell gets automatically deselected whenever the user selects it. Default: FALSE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoDeselect;
  • If property is TRUE, the cell automatically dismisses the keyboard (if applicable) when another cell is selected or when the value of another cell is changed. Default: TRUE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoResignFirstResponder;
  • The cell’s editing style.

    Declaration

    Objective-C

    @property (nonatomic) UITableViewCellEditingStyle cellEditingStyle;
  • Determines if the cell’s value is required. If TRUE, valueIsValid will only return true if the cells value is not empty. Default: FALSE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL valueRequired;
  • Determines whether to automatically validate the cell’s value. Where applicable, each subclass provides its own rules for validating the cell’s value. If the user chooses to provide custom validation using either the cell’s actions, or the model’s SCTableViewModelDelegate, they should set this property to FALSE. Default: TRUE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoValidateValue;
  • This property is TRUE if the cell’s value is valid. The validity of the cell’s value depend on the valueRequired and the validateValue properties. If valueRequired is TRUE, valueIsValid is TRUE only if the cell contains a value. If validateValue is TRUE, valueIsValid depends on each subclass to provide validation of the cell’s value. For validation, the user can also provide custom validation using either the cell’s actions, or the model’s SCTableViewModelDelegate.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL valueIsValid;
  • Options for the generated detail view controller (only applicable to subclasses with a detail view controller).

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCDetailViewControllerOptions *detailViewControllerOptions;
  • The theme style used to style the cell. A nil ‘themeStyle’ value will use the style having the same name of the cell’s class name. If no style with the class name is found, the name of the super class will be used, and so on. Default: nil.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *themeStyle;

Managing Cell Value

  • Set this property to TRUE for the cell to commit its value as soon as it is changed. If this value is FALSE, the user must explicitly call commitChanges for the cell to commit its value changes. Default: TRUE.

    Declaration

    Objective-C

    @property (nonatomic) BOOL commitChangesLive;
  • This propery is TRUE if the cell value has changed and needs to be committed. If commitChangesLive is TRUE, this property always remains FALSE.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL needsCommit;
  • Commits any changes to the cell’s value either to the bound object or the bound key where applicable (see class overview).

    Declaration

    Objective-C

    - (void)commitChanges;
  • Reload’s the cell’s bound value in case the associated boundProperty value has changed by means other than the cell itself (e.g. external custom code).

    Declaration

    Objective-C

    - (void)reloadBoundValue;

Misc. Properties

  • Is TRUE if the cell is a special cell. Special cells are cells like addNewItemCell or placeholderCell and typically exist within an SCArrayOfItemsSection.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isSpecialCell;

Internal Properties & Methods (should only be used by the framework or when subclassing)