Simply demonstrate the effect and implement it directly in the Ingress class
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions{Self.window=[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //Override point for customization after application launch.Self.window.backgroundColor =[Uicolor Whitecolor]; [Self.window makekeyandvisible]; UISlider*slider =[[UISlider alloc] init]; Slider.center= Cgpointmake ( the, -); Slider.bounds= CGRectMake (0,0, -, -); Slider.tag= -; Slider.minimumvalue=0; Slider.maximumvalue= -; Slider.minimumtracktintcolor= [Uicolor Greencolor];//A color that has been slippedSlider.maximumtracktintcolor = [Uicolor Bluecolor];//the color of the slider barSlider.value = -; [Slider addtarget:self action: @selector (Changevoice:) forcontrolevents:uicontroleventvaluechanged]; [Self.window Addsubview:slider]; _imageview=[[Uiimageview alloc] init]; _imageview.center= Cgpointmake ( -, -); _imageview.bounds= CGRectMake (0,0, -, -); _imageview.image= [UIImage imagenamed:@"Mid.png"]; [Self.window Addsubview:_imageview]; //[Nstimer scheduledtimerwithtimeinterval:0.01 target:self selector: @selector (addvalue:) Userinfo:slider repeats: YES];UIButton*BTN =[UIButton Buttonwithtype:uibuttontypesystem]; Btn.frame= CGRectMake (0,0, -, -); [_imageview ADDSUBVIEW:BTN]; _imageview.userinteractionenabled=YES; [Btn addtarget:self Action: @selector (Voicechange) forcontrolevents:uicontroleventtouchupinside]; returnYES;}//The timer method, the sound automatically increases, but at this time although the value of the slider changes, but does not trigger the method- (void) AddValue: (Nstimer *) timer{UISlider*slider = (UISlider *) [Timer userInfo]; if(Slider.value < -) {Slider.value+=0.1; }}//the high and low levels of sound can be represented by icons.- (void) Changevoice: (UISlider *) slider{if(Slider.value = =0) {_imageview.image= [UIImage imagenamed:@"None.png"]; return; } if(Slider.value < -) {_imageview.image= [UIImage imagenamed:@"Low.png"]; return; } if(Slider.value < -) {_imageview.image= [UIImage imagenamed:@"Mid.png"]; return; } if(Slider.value <= -) {_imageview.image= [UIImage imagenamed:@"High.png"]; }}//when the sound is not 0, clicking on the sound icon always resets the sound to 0, and when the icon is clicked again, the sound is restored- (void) voicechange{UISlider*slider = (UISlider *) [Self.window Viewwithtag: -]; Static intCount =0; Count++; if(Count%2!=0) {_voicevalue= Slider.value;//remember the last sound.Slider.value =0; } Else { if(Slider.value! =0)//The sound adjustment is no longer 0 before the sound is restored, using recursion{[Self voicechange]; Count=0; } slider.value=_voicevalue; }}@end
The timer in the code would have been like a mock-up of the effect of making the sound auto-lifted, and it was not possible to demonstrate it, but to think that the slider would have to interact with the user in order to show the meaning of its existence.
The sound display effect produced by UISlider