私は iphone 開発の初心者 (Xcode で 4 日目) で、AvAudioPlayer を実装し、AwesomeMenu ライブラリを使用して制御しようとしています。オーディオの初期化と再生に問題はありませんが、すばらしいメニュー コントロールを介してオーディオを一時停止または停止しようとすると、AVAudioPlayer が応答しません。どんな助けでも大歓迎です。
編集
メソッドがその中で条件付きの if/else ステートメントを実行していないことを確認できました。これはさらに不可解です。didSelectIndex はトリガーされていますが、内部の if ステートメントはそうではありません。条件ステートメントを正しくコーディングしていますか?
私のコード:
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
podcastPlayer = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[podcastPlayer play];
//Control for AvAudioPlayer
- (void)AwesomeMenu:(AwesomeMenu *)menu didSelectIndex:(NSInteger)idx{
if (idx==0) {
if(!podcastPlayer.isPlaying){
podcastPlayer.play;
}
}else if(idx==1){
if(podcastPlayer.isPlaying){
podcastPlayer.pause;
}
}else if(idx==2){
if(podcastPlayer.isPlaying){
podcastPlayer.stop;
podcastPlayer.release;
GSCCAppDelegate *appDelegate = (GSCCAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.menu removeFromSuperview];
}
}else if(idx==3){
}else if(idx==4){
}else if(idx==5){
}
NSLog(@"Select the index : %d",idx);
}
編集
- (void)AwesomeMenu:(AwesomeMenu *)menu didSelectIndex:(NSInteger)idx{
if (idx==0) {
NSLog(@"Index 0"); //Doesn't work
}else if(idx==1){
NSLog(@"Index 1"); //Doesn't work
}
}
NSLog(@"Select the index : %d",idx); //<--This Works.
}