2012-10-21 207 views
1

爲什麼iOS 6 SDK仍使用舊的MPVolumeView控件的樣式。我想要使​​用Apple默認音樂應用程序中的默認樣式。默認MPVolumeView樣式

老一: enter image description here

新:

enter image description here

有沒有辦法在我的項目中使用新的?

謝謝!

回答

3

還有一種方法可以在不使用UISlider控件的情況下做到這一點。

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]; 

而且volumeManager是

@property (strong, nonatomic) IBOutlet MPVolumeView *volumeManager;