问题
Why iOS 6 SDK still uses old MPVolumeView control's style. I want to use default style like in Apple's Default Music application.
Old one:
New one:
Is there any way to use new one in my project?
Thank you!
回答1:
There is an another way to do this without using an UISlider control.
UIImage *minImage = [UIImage imageNamed:@"bar-bg"];
UIImage *maxImage = [UIImage imageNamed:@"bar-bg-active"];
UIImage *tumbImage= [UIImage imageNamed:@"circle"];
// 276 x 14 px images used for min and max
// so i need to make the images into very small images by making resizable otherwise it strechs very ugly
minImage = [minImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 0)];
maxImage = [maxImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 20)];
[volumeManager setMinimumVolumeSliderImage:minImage forState:UIControlStateNormal];
[volumeManager setMaximumVolumeSliderImage:maxImage forState:UIControlStateNormal];
[volumeManager setVolumeThumbImage:tumbImage forState:UIControlStateNormal];
And volumeManager is
@property (strong, nonatomic) IBOutlet MPVolumeView *volumeManager;
来源:https://stackoverflow.com/questions/13001655/default-mpvolumeview-style