1
我正在使用自定义声音调度本地通知。 但我需要的是设置音量级别和振动手机一起通知。可能吗?UILocalNotification声音和振动设置IOS
我正在使用自定义声音调度本地通知。 但我需要的是设置音量级别和振动手机一起通知。可能吗?UILocalNotification声音和振动设置IOS
大约三年前,当应用程序从我的BLE标记中收到触发器时,我使用下面的代码来推高音量。但是我不知道你是否可以通过本地通知来完成这件事。
- (void) maxDeviceVolume:(float) vol
{
UISlider *volumeSlider;
MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
for (UIView *view in [myVolumeView subviews]) {
if ([[[view class] description] isEqualToString:@"MPVolumeSlider"]) {
volumeSlider = (UISlider *)view;
}
}
[volumeSlider setValue:vol animated:NO];
}
它会自动振动,无论您的iphone按钮上是否开启/关闭声音 - 如果用户将在您的应用程序的设置中设置声音,则不会发生任何情况。 –
您只能在设置的“个人资料”标签下设置通知的声音 –