I'm experiencing the same issue. My current workaround is to destroy and re-add the slider after a screen rotation:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
//remove the old view
for (UIView *subview in self.volumeViewContainer.subviews)
[subview removeFromSuperview];
//recreate it
UIImage *slider = [[UIImage imageNamed:@"slider"] resizableImageWithCapInsets:UIEdgeInsetsMake(0.0, 15.0, 0.0, 15.0)];
UIImage *knobImage = [UIImage imageNamed:@"slider_knob"];
MPVolumeView *volumeView = [[[MPVolumeView alloc] initWithFrame:self.volumeViewContainer.bounds] autorelease];
[volumeView setMinimumVolumeSliderImage:slider forState:UIControlStateNormal];
[volumeView setMaximumVolumeSliderImage:slider forState:UIControlStateNormal];
[volumeView setVolumeThumbImage:knobImage forState:UIControlStateNormal];
[self.volumeViewContainer addSubview:volumeView];
}
Doing that there is still the issue that the slider is still displayed with glitches DURING rotation. That's why I render the slider to an image and swap the slider with said image before a rotation takes place:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
//render to UIImage
UIGraphicsBeginImageContextWithOptions(self.volumeViewContainer.frame.size, NO, 0.0);
[self.volumeViewContainer.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//remove old slider
for (UIView *subview in self.volumeViewContainer.subviews)
[subview removeFromSuperview];
//add UIImageView which resizes nicely with the container view
UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.volumeViewContainer.bounds] autorelease];
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
imageView.image = img;
[self.volumeViewContainer addSubview:imageView];
}
I know that this is not a real solution, but I think it's better than nothing and I hope it helps you.