// // EMCompoundResourceCell.m // Compound Example // // Created by Dexter Weiss on 12/17/13. // Copyright (c) 2013 Emmoco. All rights reserved. // #import "EMCompoundResourceCell.h" @interface EMCompoundResourceCell () { IBOutlet UITextField *_labelField; IBOutlet UITextField *_valueField; } @end @implementation EMCompoundResourceCell -(void)setCompoundResourceValue:(NSDictionary *)compoundResourceValue { [self willChangeValueForKey:@"compoundResourceValue"]; _compoundResourceValue = compoundResourceValue; [self didChangeValueForKey:@"compoundResourceValue"]; [self _layout]; } -(void)_layout { [_labelField setText:[[self compoundResourceValue] objectForKey:@"label"]]; NSNumber *numberValue = [[self compoundResourceValue] objectForKey:@"value"]; [_valueField setText:[NSString stringWithFormat:@"%d", [numberValue integerValue]]]; } #pragma mark - Text Field Delegate -(BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; NSDictionary *value = @{@"label" : [_labelField text], @"value" : [_valueField text]}; [[self delegate] cellDidProcessEditing:value forIndex:[self index]]; return YES; } @end