Every time I add MPVolumeView as a subtitle to my UIViewController , there is a quick animation ( MPVolumeView extension MPVolumeView left to right) that looks really weird. I am looking for a way to get rid of this animation, has anyone encountered this problem?
I almost agreed that it was an MPVolumeView error, but then I noticed that Apple definitely uses MPVolumeView in its native music application, there are no weird animations ... So there must be something that I am doing wrong.
UPDATE:
The code is pretty simple, 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 demonstrate the problem, but you need to run it on the device, since MPVolumeView does not display on the simulator. Or just take a look at this gif:
:
source share