2013-10-03 53 views
3

我的應用程序播放音頻流,它適用於所有情況下,如背景等罰款我使用AudioToolbox.frameworkMediaPlayer.framework來播放音頻,我的查詢是當應用程序開始播放音頻我想狀態欄上的指標是如對於默認的iPod播放器那樣顯示。如何在狀態欄上顯示播放指示圖標?

任何人都可以指導我如何在應用程序開始播放音頻時在狀態欄上顯示播放指示圖標,並在其暫停/停止或終止時消失。

回答

1

正如described by iHemantk

你只需要進行遠程控制的事件和圖標註冊將顯示 起來:

https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Remote-ControlEvents/Remote-ControlEvents.html#//apple_ref/doc/uid/TP40009541-CH7-SW3

他們在4.0中加入這個......效果很好。誰是第一個響應者現在 控制圖標...只是不會爲任何事情預先iOS4的工作:把下面的 您-viewDidAppear method:

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; 

[self becomeFirstResponder]; 


and include this method in the code: 


- (BOOL) canBecomeFirstResponder { 
    return YES; 
} 

this goes in `-dealloc`: 


[[UIApplication sharedApplication] endReceivingRemoteControlEvents]; 

,雖然不是必須的,你可能要包括這在 -viewWillDisappear

[self resignFirstResponder]; 
+0

的鏈接斷開! – user2068793

+0

我修好了!抱歉! –

相關問題