2012-08-08 2 views

Répondre

0
- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    [[NSNotificationCenter defaultCenter] 
    addObserver:self 
    selector:@selector(volumeChanged:) 
    name:@"AVSystemController_SystemVolumeDidChangeNotification" 
    object:nil]; 
} 

- (void)volumeChanged:(NSNotification *)notification 
{ 
    float volume = 
    [[[notification userInfo] 
     objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"] 
    floatValue]; 

    // Do stuff with volume 
} 

S'il vous plaît voir les détails de réponse sur un fil this.

+0

La méthode volumeChanged n'a jamais été appelée lorsque j'ai implémenté ceci dans mon ApplicationDelegate, malgré l'ajustement du volume. –

Questions connexes