Airplay button is showing on the UIToolbar but when clicking it nothing is happening. It should open up airplay picker. but it is not.
UIButton *volumeView = [UIButton buttonWithType:UIButtonTypeCustom];
[volumeView addTarget:self action:@selector(MPVolumeView:) forControlEvents:UIControlEventTouchUpInside];
volumeView.frame = CGRectMake(0, 0, 40, 40);
UIImage *icon = [UIImage imageNamed:@"airplay-1.png"];
[volumeView setImage:icon forState:UIControlStateNormal];
UIBarButtonItem *volumeview = [[UIBarButtonItem alloc] initWithCustomView:volumeView];
-(void)MPVolumeView:(id)sender
{
MPVolumeView *volumeView = [[MPVolumeView alloc] init];
[volumeView setShowsVolumeSlider:NO];
[volumeView setShowsRouteButton:YES];
// [volumeView sizeToFit];
[volumeView release];
}
I dont see anything wrong with the code but still wondering why it is not opening up airplay picker for scrollview images in the app. Actually in this case airplay is for uiimages. can we airplay UIImages.
Thanks for help.