有没有办法让用户选择本地通知的声音? [英] is there a way to let the user choose the sound for local notification?

查看:123
本文介绍了有没有办法让用户选择本地通知的声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程式有重复间隔的64个本地通知。因此,我无法添加更多通知,否则,我需要用户再次打开应用程序以重新安排。

I have an app that has 64 local notifications with repeat intervals. So I can't add more notifications, or otherwise, I'd need the user to open the app again for a reschedule.

我想知道我是否能够允许用户在此代码中选择文件:

I was wondering if I'm able to let the user choose the file with in this code:

notif.soundName = @"xxx.wav";

,所以他们可以选择 xyz.wav

so they can choose xyz.wav instead?

推荐答案

是的,可以让用户选择已经在项目中的声音,或者让他

Yes, you can let the user choose the sound between some that are already in your project or you could also let him take a song from the music library.

更新:
如果文件已在您的Xcode项目中,您可以创建一个NSString或一个int值来存储用户选择。您创建一个按钮,让用户选择一个声音。您连接此按钮以更改字符串或int值。然后你创建和if语句检查这个字符串或int并正确地更改UILocalnotification声音。

Update: If the files are already in your Xcode project, you can create a NSString or a int value to store the user choose. You create a button that let the user choose a sound. You connect this button to change the string or int value. Then you create and if statement that check this string or int and change properly the UILocalnotification sound.

int soundNumber;

- (IBAction)chooseSoundName {
   soundNumber = 1;
}

- (void)loadSoundName {
   if(SoundNumber == 1) {
       localNotification.soundName = @"first.wav";
   }
}

然后你调用loadSoundName方法它变成另一种方法)。

Then you call the loadSoundName method (or you could integrate it into another method).

希望它有帮助

这篇关于有没有办法让用户选择本地通知的声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆