- (void)showAirPlay
{
MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectZero];
[self.view addSubview:volumeView];
for (UIButton *button in volumeView.subviews)
{
if ([button isKindOfClass:[UIButton class]])
{
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
}
}
}
Add MPVolumeView to your view, and then send control events to the button. Keep in mind that this is very unstable, because if Apple adds another UIButton to MPVolumeView, it will break.
source
share