如何判断我的iPhone是否处于静音/静音模式?

时间:2009-09-08 08:13:03

标签: iphone uikit notifications

如何以编程方式确定iPhone是否处于礼貌模式?有没有办法判断耳机是否已连接?

编辑:在世界某些地方也称为静音模式。

1 个答案:

答案 0 :(得分:3)

http://www.iphonedevsdk.com/forum/iphone-sdk-development/21456-detect-wheather-phone-silent-mode-ring-mode.html

上似乎有一个例子

转载自Narender Mugdal

CFStringRef route;
UInt32 propertySize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_Audi oRoute, &propertySize, &route);
NSString *outputString = (NSString*)route; 
//NSLog(@"%@", outputString);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message: outputString delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];