iosobjective-cmedia-playeruislidermpvolumeview

How can I set the tint color of a MPVolumeView?


How can I set the tint color of a MPVolumeView?

I see the method:

setMinimumTrackTintColor: 

and the property

minimumTrackTintColor

however using either of those throws an exception.

I was told I need to call

setMinimumTintColor 

or set the property

minimumTrackTintColor 

on the underlying UISlider, however I don't know how to do that.

Thanks!


Solution

  • In iOS 7 you simply can change the slider color of a MPVolumeView like this:

    CGRect rect1 = CGRectMake(17, 45, 220, 0);
    MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:rect1];
    
    volumeView.tintColor = [UIColor colorWithRed:0.0f/255.0f green:255.0f/255.0f blue:127.0f/255.0f alpha:1.0f];
    

    Hope this helps.