MPVolumeView's slider setVolumeThumbImage:forState: not working on iOS5

532 views Asked by At

oI use a MPVolumeView to display a volume slider. I've customized it with

        [myVolumeView setVolumeThumbImage:[UIImage imageNamed:@"sound_slider_knob.png"] forState:UIControlStateNormal];
        [myVolumeView setVolumeThumbImage:[UIImage imageNamed:@"sound_slider_knob.png"] forState:UIControlStateHighlighted];
        [myVolumeView setMaximumVolumeSliderImage:[UIImage imageNamed:@"slider_player_bg.png"] forState:UIControlStateNormal];
        [myVolumeView setMinimumVolumeSliderImage:[UIImage imageNamed:@"slider_player_fg.png"] forState:UIControlStateNormal];

everything works fine on iOS6, but on iOS5, I get this error message :

-[MPVolumeView setVolumeThumbImage:forState:]: unrecognized selector sent to instance 0x8c29f30
-[UIDevice identifierForVendor]: unrecognized selector sent to instance 0x8909b30

And it's actually true that in MPVolumeView.h there is

- (void)setVolumeThumbImage:(UIImage *)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0);

Is there any way to custom MPVolumeView in iOS 5 ?

1

There are 1 answers

0
Anticro On

In iOS 5 and earlier you must search the subviews of the MPVolumeView for a UISlider and customize the slider.