Thursday, 15 July 2010

ios - Add and decrease time with UIButton to Timer -



ios - Add and decrease time with UIButton to Timer -

hello have question how can add together , decrease time uibutton timer illustration if have button minus , plus , time @ timer.

thank you.

-(void)viewdidload{ uibutton *buttonplus = [uibutton buttonwithtype:uibuttontyperoundedrect]; uibutton *buttonminus = [uibutton buttonwithtype:uibuttontyperoundedrect]; [buttonplus addtarget:self action:@selector(addtime) forcontrolevents:uicontroleventtouchupinside]; [buttonminus addtarget:self action:@selector(removetime) forcontrolevents:uicontroleventtouchupinside]; [self.view addsubview:buttonminus]; [self.view addsubview:buttonplus]; } -(void) addtime { [yourtimer setfiredate:[[yourtimer firedate] datebyaddingtimeinterval:secondstoadd]]; } -(void) removetime { [yourtimer setfiredate:[[yourtimer firedate] datebyaddingtimeinterval:-secondstoadd]]; }

ios objective-c uibutton nstimer

No comments:

Post a Comment