In iOS 5 there were some hoops to jump through. In iOS 6, it's much easier. Add a MPVolumeView
and use setRouteButtonImage:forState:
to change the icon:
airplayView = [[MPVolumeView alloc] initWithFrame:airplayContainer.bounds];
airplayView.showsVolumeSlider = NO;
[airplayView setRouteButtonImage:[UIImage imageNamed:@"airplay"] forState:UIControlStateNormal];
[airplayView setRouteButtonImage:[UIImage imageNamed:@"airplay-highlighted"] forState:UIControlStateHighlighted];
[airplayView setRouteButtonImage:[UIImage imageNamed:@"airplay-selected"] forState:UIControlStateSelected];
[airplayContainer addSubview:airplayView]; // or add it to your toolbar or wherever
airplayContainer
is just a plain UIView
I added in Interface Builder to get the layout I wanted.