コードは次のとおりです。
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *musicURL = [NSURL URLWithString:@"http://live-three2.dmd2.ch/buureradio/buureradio.m3u"];
if([musicURL scheme])
{
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:musicURL];
if (mp)
{
// save the music player object
self.musicPlayer = mp;
[mp release];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(popBack:) name:@"MPMoviePlayerDidExitFullscreenNotification" object:nil];
// Play the music!
[self.musicPlayer play];
}
}
}
-(void)popBack:(NSNotification *)note
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
セレクター メソッドが呼び出されることはありません。ムービープレーヤーで「完了」ボタンが押されたときに、ルートメニューに戻りたいだけです。セレクターに NSLog を入れて、それが呼び出されているかどうかを確認しましたが、何もありませんでした。音楽はうまく再生されます。何かご意見は?