iphone - Connecting UIButton1 with UIButton2 by calling method of UIButton2 in the method of UIButton1 -


to connect uibutton1 uibutton2, calling method of uibutton2 in method of uibutton1, makes uibutton1 acts uibutton2 not requirement is. uibutton1 acting uibutton2.

uibutton1 rewind button

-(void)rewind:(id)sender{ audioplayer.currenttime = 0; [timer invalidate]; containerviewcontroller *viewcontroller = [[[containerviewcontroller alloc] init]autorelease]; viewcontroller.view.frame = cgrectmake(0, 0, 320, 480); [self.view addsubview:viewcontroller.view]; [self.view addsubview:toolbar]; [self playpauseaction:_playbutton]; } 

uibutton2 play pause button

-(void)playpauseaction:(id)sender { if([audioplayer isplaying]) { [sender setimage:[uiimage imagenamed:@"play icon.png"] forstate:uicontrolstateselected]; [audioplayer pause]; [self pausetimer]; [self pauselayer:self.view.layer]; }else{ [sender setimage:[uiimage imagenamed:@"52.png"] forstate:uicontrolstatenormal]; [audioplayer play]; [self resumetimer]; [self resumelayer:self.view.layer]; if(isfirsttime == yes) { self.timer = [nstimer scheduledtimerwithtimeinterval:11.0 target:self selector:@selector(displayviewsaction:) userinfo:nil repeats:no]; isfirsttime = no; }} } 

requirement uibutton1 should act uibutton1 , uibutton2 should act uibutton2 when uibutton2 method called in uibutton1 method.

technically requirement when rewind button pressed , playing audio file beginning there should option available pause. if don't call uibutton2 method in uibutton1 method don't have pausing option available users. reason of calling uibutton2 method in uibutton1 method.

so when rewind button pressed toggle play button pause button fine testing purposes if press rewind button again pauses means acting play pause button , if press rewind button again play beginning.

how can stop uibutton1 acting uibutton2.

thanks help.

ok it's bit complicated follow description, understand want playback gets paused on rewind, user can press play again.

you need check, if you're playing @ moment, before toggling button.

if([audioplayer isplaying]) { [self playpauseaction:_playbutton]; } 

so pause playback , show play button again. want?


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -