我刚刚将一个应用程序从 Xcode 5 更新到 Xcode 6,没有任何变化,也没有任何问题。但是,当在 iOS 8 设备上运行应用程序时,我的自定义mpVolumeView
现在有操作系统默认轨道和拇指覆盖我的自定义轨道和拇指。
我未更改的音量控制代码是这样的:
// Set up volume control
[[self mpVolumeView] setBackgroundColor:[UIColor clearColor]];
MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame: [[self mpVolumeView] bounds]];
[[self mpVolumeView] addSubview:myVolumeView];
for (UIView *view in [myVolumeView subviews]) {
if ([[[view class] description] isEqualToString:@"MPVolumeSlider"])
{ // Find the volume view slider
volumeViewSlider = (UISlider *) view;
}
}
UIImage *volumeLeftCap = [[UIImage imageNamed:@"volume-left-cap.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 16, 0, 0)];
UIImage *volumeRightCap = [[UIImage imageNamed:@"volume-right-cap.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 16)];
[volumeViewSlider setMinimumTrackImage:volumeLeftCap forState:UIControlStateNormal];
[volumeViewSlider setMaximumTrackImage:volumeRightCap forState:UIControlStateNormal];
// Note: on iOS7 it is necessary to set the thumb image last or the thumb will
// be drawn under the slider, on iOS6 the order didn't seem to matter.
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1)
{ // iOS 7.0 or greater
[volumeViewSlider setThumbImage: [UIImage imageNamed:@"thumb-iOS7.png"]
forState:UIControlStateNormal];
}
else {
// Earlier versions of iOS...
[volumeViewSlider setThumbImage: [UIImage imageNamed:@"thumb.png"]
forState:UIControlStateNormal];
}
新的结果可以在这里看到:
有没有人看到这个问题或者我应该提交错误报告?