Default MPVolumeView Style

别等时光非礼了梦想. 提交于 2019-12-11 11:39:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!