我正在创建一个非常简单的应用程序.2个按钮,都播放声音.每个剪辑持续1秒钟并响应"TouchUpInside".它们是我在iTunes中转换的.caf文件.
这是我的代码,再次,它在模拟器中工作,但不在设备上:
enter code here- (void)viewDidLoad {
NSLog(@"InView did load");
AudioServicesCreateSystemSoundID ((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"bigaif" ofType:@"caf"]], &systemSoundID);
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource: @"smallwav" ofType:@"wav"]],
&systemSoundIDTwo);
Run Code Online (Sandbox Code Playgroud)
}
-(IBAction) playSound:(id) sender {
AudioServicesPlaySystemSound(systemSoundID);
}
-(IBAction) playSoundTwo:(id) sender {
AudioServicesPlaySystemSound(systemSoundIDTwo);
Run Code Online (Sandbox Code Playgroud)
}
我正在开始Objective-C,目的是进入广泛的iPhone开发.一些好的起点在哪里?我买了2本书:
由Stephen Kochan编写的Objective-C编程和由Dave Mark和Jeff LaMarche开始的iPhone开发
教程很好,我只想进入自己的想法,因为很难用别人的话来包围事物.
有任何想法吗?