Welcome, Guest
Username Password: Remember me

Implementing an Input Mask in a SCTextFieldCell
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Implementing an Input Mask in a SCTextFieldCell

Implementing an Input Mask in a SCTextFieldCell 1 year, 8 months ago #1

I am trying to create an input mask that checks/changes the textfield value with every character entered. Ex: User enters "5", field updates to $0.05, user hits 5 again, field updates to $0.55, again, $5.55, and so on.

My ViewController is setup as the SCTableViewModelDelegate and my key clicks are successfully making it to tableViewModel:valueChangedForRowAtIndexPath. I can access everything in the field using "tableViewModel.activeCell".

Where I'm lost is trying to get the newly formatted value to display in the textfield. I can update the textLabel and detailTextLabel on the fly...but I just can't seem to figure out how to update the actual text field I am typing in. I can capture the keyclicks using tableViewModel.activeCell.boundValue but updating this doesn't update what is displayed in the text field.

Is there some other property or delegated method I should be using? I get the feeling I am making something simple into something difficult

Thanks!
  • kes815
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 0
Last Edit: 1 year, 8 months ago by kes815. Reason: Sorry I accidentally put this in bug reports, was just an question!

Re: Implementing an Input Mask in a SCTextFieldCell 1 year, 8 months ago #2

Is the following what you're looking for?

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel valueChangedForRowAtIndexPath:(NSIndexPath *)indexPath
{
SCTableViewCell *cell = [tableViewModel cellAtIndexPath:indexPath];
if([cell isKindOfClass:[SCTextFieldCell class]])
{
SCTextFieldCell *textFieldCell = (SCTextFieldCell *)cell;
 
textFieldCell.textField.text = ...//whatever text you want here
}
}
 


Hope this helps
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Implementing an Input Mask in a SCTextFieldCell 1 year, 8 months ago #3

Thank you. Exactly what I needed!
  • kes815
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 0
  • Page:
  • 1
Time to create page: 1.32 seconds