SCCustomCell
@interface SCCustomCell
: SCTableViewCell <UITextViewDelegate, UITextFieldDelegate> {
BOOL _pauseControlEvents;
NSMutableDictionary *_objectBindings;
BOOL _autoResize;
BOOL _showClearButtonInInputAccessoryView;
}
This class functions as a base class for all user defined custom cells.
The following is a summary of each control that can be automatically bound, in addition to the corresponding boundObject property value type that it must be associated with:
- UILabel: NSString, NSNumber, NSDate
- UITextField: NSString, NSNumber, NSDate
- UITextView: NSString, NSNumber, NSDate
- UISlider: NSNumber, NSString
- UISegmentedControl: NSNumber, NSString
- UISwitch: NSNumber
- UIImage: NSString
-
Undocumented
Declaration
Objective-C
BOOL _pauseControlEvents
-
Undocumented
Declaration
Objective-C
NSMutableDictionary *_objectBindings
-
Undocumented
Declaration
Objective-C
BOOL _autoResize
-
Undocumented
Declaration
Objective-C
BOOL _showClearButtonInInputAccessoryView
-
Allocates and returns an initialized ‘SCCustomCell’ given cell text, custom object bindings, and a nib file name. Use this type of constructor in cases where the bound object is not yet known and will be provided later by the framework. A common case is when implementing the SCTableViewModelDataSource method called ‘tableViewModel:cellForRowAtIndexPath:’.
Note
This constructor is usually used to construct custom cells that are either created in Interface Builder, or created by subclassing ‘SCCustomCell’.Warning
All control tags must be greater than zero.Note
it’s ok for this parameter to be nil if the cell has no corresponding nib file.Declaration
Objective-C
+ (instancetype)cellWithText:(NSString *)cellText objectBindings:(NSDictionary *)bindings nibName:(NSString *)nibName;
Parameters
cellText
The text that will appear in the cell’s textLabel.
bindings
The cell’s object bindings. This dictionary specifies how each of the cell’s custom controls binds itself to its boundObject’s properties. Each dictionary key should be the tag string value of one of the cell’s custom controls, and the value should be the name of the boundObject’s property that is bound to that control.
nibName
The name of the nib file to load the cell from. The nib file should only contain one cell, and it should be a subclass of ‘SCControlCell’.
-
Allocates and returns an initialized ‘SCCustomCell’ given cell text, custom object bindings string, and a nib file name. Use this type of constructor in cases where the bound object is not yet known and will be provided later by the framework. A common case is when implementing the SCTableViewModelDataSource method called ‘tableViewModel:cellForRowAtIndexPath:’.
Note
This constructor is usually used to construct custom cells that are either created in Interface Builder, or created by subclassing ‘SCCustomCell’.Warning
All control tags must be greater than zero.Note
it’s ok for this parameter to be nil if the cell has no corresponding nib file.Declaration
Objective-C
+ (instancetype)cellWithText:(NSString *)cellText objectBindingsString:(NSString *)bindingsString nibName:(NSString *)nibName;
Parameters
cellText
The text that will appear in the cell’s textLabel.
bindingsString
The cell’s object bindings string. This string specifies how each of the cell’s custom controls binds itself to its boundObject’s properties. The string’s format should be as follows: @“tag1:propertyName1;tag2:propertyName2;tag3:propertyName3”
nibName
The name of the nib file to load the cell from. The nib file should only contain one cell, and it should be a subclass of ‘SCControlCell’.
-
Allocates and returns an initialized ‘SCControlCell’ given cell text, bound object, custom object bindings, and a nib file name.
Note
This constructor is usually used to construct custom cells that are either created in Interface Builder, or created by subclassing ‘SCControlCell’.Warning
All control tags must be greater than zero.Note
It’s ok for this parameter to be nil if the cell has no corresponding nib file.Declaration
Objective-C
+ (instancetype)cellWithText:(NSString *)cellText boundObject:(NSObject *)object objectBindings:(NSDictionary *)bindings nibName:(NSString *)nibName;
Parameters
cellText
The text that will appear in the cell’s textLabel.
object
The cell’s bound object (see SCTableViewCell class overview).
bindings
The cell’s object bindings. This dictionary specifies how each of the cell’s custom controls binds itself to the boundObject’s properties. Each dictionary key should be the tag string value of one of the cell’s custom controls, and the value should be the name of the boundObject’s property that is bound to that control.
nibName
The name of the nib file to load the cell from. The nib file should only contain one cell, and it should be a subclass of ‘SCControlCell’.
-
This dictionary specifies how each of the cell’s custom controls binds itself to the boundObject’s properties.
Each dictionary key should be the tag string value of one of the cell’s custom controls, and the value should be the name of the boundObject’s property that is bound to that control.
Warning
All control tags must be greater than zero.Note
This property can be used interchangibly with objectBindingsStringDeclaration
Objective-C
@property (nonatomic, readonly) NSMutableDictionary *objectBindings;
-
This string specifies how each of the cell’s custom controls binds itself to the boundObject’s properties. The string should consist of a colon separated pair of control’s tag and the property name, while each pair should be separated by a semi-colon.
Example bindings string: NSString *bindingsString = @“1:firstName;2:lastName”;
Warning
IMPORTANT: All control tags must be greater than zero.Note
This property can be used interchangibly with objectBindings. Setting this property does not remove previous values from objectBindings.Declaration
Objective-C
@property (nonatomic, copy) NSString *objectBindingsString;
-
Determines if cell should automatically resize to fit its contents. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL autoResize;
-
Show the ‘Clear’ button in the model’s inputAccessoryView.
Declaration
Objective-C
@property (nonatomic) BOOL showClearButtonInInputAccessoryView;
-
Adds the controlTag:propertyName key-value pair to the objectBindings dictionary.
Declaration
Objective-C
- (void)setObjectBindingsPropertyName:(NSString *)propertyName forControlWithTag:(NSInteger)controlTag;
-
Returns the control with the given tag value. Returns nil if controlTag is less than 1.
Declaration
Objective-C
- (UIView *)controlWithTag:(NSInteger)controlTag;
-
Returns the bound value for the control with the given tag value. Returns nil if controlTag is less than 1.
Declaration
Objective-C
- (NSObject *)boundValueForControlWithTag:(NSInteger)controlTag;
-
Commits the bound value for the control with the given tag value.
Declaration
Objective-C
- (void)commitValueForControlWithTag:(NSInteger)controlTag value:(NSObject *)controlValue;
-
An array of all the cell’s input controls sorted by their tag value. Property is used internally by the framework.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray *inputControlsSortedByTag;
-
Method must be called by subclasses to configure any added custom controls for automatic binding.
Declaration
Objective-C
- (void)configureCustomControls;
-
Method called internally by framework.
Declaration
Objective-C
- (void)loadBindingsIntoCustomControls;
-
Method called internally by framework to reload control values, if needed.
Declaration
Objective-C
- (void)reloadControlValuesIfNeeded;
-
Method gets called internally whenever the value of a UITextField control is changed.
Declaration
Objective-C
- (void)textFieldEditingChanged:(id)sender;
-
Method gets called internally whenever the value of a UISlider control is changed.
Declaration
Objective-C
- (void)sliderValueChanged:(id)sender;
-
Method gets called internally whenever the value of a UISegmentedControl is changed.
Declaration
Objective-C
- (void)segmentedControlValueChanged:(id)sender;
-
Method gets called internally whenever the value of a UISwitch control is changed.
Declaration
Objective-C
- (void)switchControlChanged:(id)sender;
-
Method gets called internally whenever the a custom button is tapped.
Declaration
Objective-C
- (void)customButtonTapped:(id)sender;
-
Undocumented
Declaration
Objective-C
- (void)callDidBecomeFirstResponderActions;
-
Undocumented
Declaration
Objective-C
- (void)callDidResignFirstResponderActions;
-
Undocumented
Declaration
Objective-C
- (void)setInitialControlValueIfNeeded:(id)value propertyName:(NSString *)propertyName;