ナビゲーションコントローラーの下部バーにMPVolumeViewのインスタンスを追加しようとしています(ツールバーのボックスがオンになっています)コードでエラーは発生しませんが、デバイスでプロジェクトを実行すると、ボリュームスライダーが表示されません表示しています。提案を事前に感謝します、ここに私のコードがあります:
@interface ViewController ()
{
AVPlayer *vPlayer;
AVPlayerItem *playerItem;
UISegmentedControl *segm;
UIToolbar *toolbar;
}
@end
@implementation ViewController
@synthesize myViewVolume;
@synthesize nowPlaying;
- (void)viewDidLoad
{
[super viewDidLoad];
playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://vibesradio.org:8000 /listen.pls"]];
vPlayer = [[AVPlayer alloc] initWithPlayerItem:playerItem];
[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:NULL];
//self.myViewVolume = [[MPVolumeView alloc] initWithFrame:CGRectMake(20, 330, 280, 50)];
self.myViewVolume = [[MPVolumeView alloc] initWithFrame: toolbar.bounds];
[self.myViewVolume sizeToFit];
[self.view addSubview:toolbar];
[toolbar addSubview:self.myViewVolume];
}