Version 1 Easier to code, not so elegant.
xcode , MyProjectViewController.xib, , .
MyProjectViewController.h .m, :
- (IBAction) playMiddleC: (id) sender;
- (IBAction) playMiddleD: (id) sender;
- (IBAction) playMiddleE: (id) sender;
File Owner ( MyProjectViewController). , , - .
, . , , midC.caf (, , PCM, ). , ( xcode) "" "" > " ", .
AudioToolbox . , Frameworks "" > " ", AudioToolbox .
, MyProjectViewController.m, :
#import <AudioToolbox/AudioServices.h>
- (IBAction) playMiddleC: (id) sender {
NSString* path = [[NSBundle mainBundle]
pathForResource:@"midC" ofType:@"caf"];
NSURL* url = [NSURL URLWithString:path];
SystemSoundID midC;
AudioServicesCreateSystemSoundID((CFURLRef)url, &midC);
AudioServicesPlaySystemSound(midC);
}
Hit Command-Enter !
2 .
, ( ). UIButton (, C/F, B/E A/D/G, - ).
, , .
, , . AudioQueue, , , , "" . , .
,, , , . iPhone - , , . , , , , UITableView , , ( , iPhone SDK ).
!