ios - UIprogressView Status based on text entered on UITextfield -


i progress uiprogressview status based on text entered in uitextfield.

if entered 3 letters, should 25%, , if 5 letters should 50% , on

the simplest solution use textfielddidchangemethod.
since uitextfielddelegate don't have that, can add behavior of uitextfield (or subclassed textfield matter) with:

[yourtextfield addtarget:self                    action:@selector(textfielddidchange)          forcontrolevents:uicontroleventeditingchanged]; 

and in target method:

- (void) textfielddidchange {     float txtprogress = yourtextfield.text.length / 10.0;     [yourprogressview setprogress:txtprogress animated:yes]; } 

edit : can use uitextfieldtextdidchangenotification controlevent.
both seem work fine.


Comments

Popular posts from this blog

node.js - StackOverflow API not returning JSON -

ios - Apple Push Notifications + TestFlight + Enterprise wildcard provisioning profile -

android - Drag and drop in ScrollView -