Every time I add MPVolumeView
as a subview to my UIViewController
’s view, there is a quick animation (the MPVolumeView
expands from left to right) which looks really weird. I’m looking for a way to get rid of this animation, has anyone faced this issue?
I almost accepted that this is a MPVolumeView
bug but then I noticed that Apple is definitely using a MPVolumeView
in their native music app, no weird animations there...
So there must be something I'm doing wrong.
UPDATE:
The code is pretty straightforward but it was requested in the comments, so here it is:
MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(10.f, 0.f, CGRectGetWidth(self.view.frame) - 20.f, 30.f)];
[[UISlider appearanceWhenContainedIn:[MPVolumeView class], nil] setMinimumValueImage:[UIImage imageNamed:@"icon-volumeMin"]];
[[UISlider appearanceWhenContainedIn:[MPVolumeView class], nil] setMaximumValueImage:[UIImage imageNamed:@"icon-volumeMax"]];
volumeView.center = CGPointMake(0.5f * CGRectGetWidth(self.view.frame), 0.5f * CGRectGetHeight(self.view.frame));
volumeView.showsRouteButton = NO;
[self.view addSubview:volumeView];
I made a very simple project on github to demostrate the problem, but you have to run it on a device, since MPVolumeView
does not show up on simulator. Or just take a look at this gif:
: