MPVolumeView滑块设置VolumeThumbImage:for State:不适用于iOS5

时间:2013-09-03 09:58:53

标签: ios ios5 uislider mpvolumeview

o使用MPVolumeView显示音量滑块。我用

定制了它
        [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];

在iOS6上一切正常,但在iOS5上,我收到此错误消息:

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

实际上,在MPVolumeView.h中有

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

有没有办法在iOS 5中自定义MPVolumeView?

1 个答案:

答案 0 :(得分:0)

在iOS 5及更早版本中,您必须搜索UISlider的MPVolumeView的子视图并自定义滑块。