0

私は iOS 開発に不慣れで、なぜこれが機能するのかを誰かが理解するのを手伝ってくれるかどうか疑問に思っていますか? @synthesize は何をしますか?

.h で

@property (strong, nonatomic) AVAudioPlayer *player;

.m

@synthesize player;

-(void)startMusic{
    NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"audio" ofType:@"m4a"];
    NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
    player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
    player.numberOfLoops = -1; //infinite
    [player play];
}
4

1 に答える 1