我做了一个iPhone应用程序,在运动时使用.它会播放铃声,表示您(用户)应该从练习例程的一个步骤切换到下一个步骤.我设计了应用程序,以便您在使用应用程序时可以在iPod上听音乐,我希望音调可以在音乐上充分发声.我已经让这个工作......有点......
当音乐响亮时,很难听到音调.我理想的解决方案类似于iPod应用程序处理传入短信或电子邮件的方式.音乐音量降低,声音播放,音乐音量逐渐消失.
以下是我到目前为止尝试过的方法:
我以前常常AudioServicesPlaySystemSound
播放声音.
我初始化声音是这样的:
CFBundleRef mainBundle = CFBundleGetMainBundle();
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, CFSTR ("bell"), CFSTR ("wav"), NULL);
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundFileID);
Run Code Online (Sandbox Code Playgroud)
我在适当的时候使用以下方式播放声音:
AudioServicesPlaySystemSound (self.soundFileID);
Run Code Online (Sandbox Code Playgroud)
这播放声音很好,但是听到嘈杂的音乐太难了.试图2 ...
我试图降低iPod音量,播放声音,然后将音量恢复到之前的水平.
如果当前步骤还剩1秒,则开始降低音量:
if ([self.intervalSet currentStepTimeRemainingInSeconds] == 1) {
self.volumeIncrement = originalVolume/5.0f;
[NSTimer scheduledTimerWithTimeInterval:0.5f
target:self
selector:@selector(fadeVolumeOut:)
userInfo:[NSNumber numberWithInt:1]
repeats:NO];
}
Run Code Online (Sandbox Code Playgroud)
这是fadeVolumeOut:
方法:
- (void) fadeVolumeOut:(NSTimer *)timer {
if (!TARGET_IPHONE_SIMULATOR) {
NSNumber *volumeStep = (NSNumber *)[timer userInfo];
int vStep = [(NSNumber *)volumeStep intValue];
float volume = [[MPMusicPlayerController iPodMusicPlayer] volume];
volume = volume - self.volumeIncrement; …
Run Code Online (Sandbox Code Playgroud)如何从导航栏上的按钮中删除光泽/闪耀效果?如果我使用自定义图像自定义导航栏按钮不受影响,我可以从中删除效果(线条和光泽),或者为整个按钮定义十六进制颜色代码,甚至也可以为它们定义自定义图像?
我开发了我的应用程序的测试版,我希望将它放在几个朋友的iPhone上进行测试.我已经完成了Developer Portal中的Ad Hoc部署步骤,我也按照这里的说明进行操作:http://www.talentgrouplabs.com/blog/archive/2008/11/10/iphone-sdk-mobile -provisioning-0xe800003a-0xe8000001.aspx.当我尝试使用Ad Hoc设置选择编译应用程序时,我得到一个"putpkt:写入失败:管道损坏".错误记录到控制台.该应用程序似乎已安装,并开始运行,因为我看到第一个屏幕一秒钟.然而,它崩溃并退出.我不知所措.有什么想法吗?以下是输出到控制台的内容:
[Session started at 2009-01-28 21:59:35 -0500.] Loading program into debugger… Warning - No location found for "AreasTableViewController.m:84" GNU gdb 6.3.50-20050815 (Apple version gdb-963) (Sun Nov 2 03:13:07 UTC 2008) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely …