Tuesday 15 March 2011

ios - working with UIProgressView to set progress bar to 30 minutes -



ios - working with UIProgressView to set progress bar to 30 minutes -

i'm working on project have set in progress bar , set button start progressbar when pressed. thing want have progress in 30min when pressed startbutton, need help set 30 minutes.

here code setup progressbar , startbutton

the m-file

- (ibaction)startbutton:(id)sender { timer = [nstimer scheduledtimerwithtimeinterval:1 target:self selector:@selector(moreprogress) userinfo:nil repeats:yes]; [super viewdidload]; //progressbar start when button pressed }

and got time

//selector progress time - (void) moreprogress { myprogressview.progress += 0.001; }

i think it's math problem.

first, myprogressview.progress can assume values 0.0 1.0.

as phone call moreprogress each second, you'll need phone call 1800 times 30 minutes. thus, myprogressview.progress should increment 1/1800 second.

change code to:

- (void) moreprogress { myprogressview.progress += 1.0/1800.0; }

hope helps you! :)

ios nstimer uiprogressview

No comments:

Post a Comment