自定义程序搭建

1---------------------------前置相机获取图片为左右翻转:使用下列方法能够兼容所有系统

   - (instancetype)initWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(4_0);

2---------------------------能够同时播放两段音频音乐 :点我查看两种音乐播放

  第一段音乐播放: 使用avplayer进行播放//实测中使用喜马拉雅进行第一段播放

  第二段音乐播放: 使用系统音进行播放//系统音能够更换为自定音频

  //----------------------系统音播放:

    - (void)playBeep

    {

        SystemSoundID sound = kSystemSoundID_Vibrate;

        //使用系统铃声

        NSString *path = [NSString stringWithFormat:@"/System/Library/Audio/UISounds/%@.%@",@"new-mail",@"caf"];

        //使用自定义铃声

      //    NSString *path = [[NSBundle mainBundle] pathForResource:@"QRCodeRead"ofType:@"wav"]; //需将音频资源copy到项目<br>

        if (path) {

            OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path],&sound);

            if (error != kAudioServicesNoError) {

                sound = 0;

            }

        }

      AudioServicesPlaySystemSound(sound);//播放声音

      AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);//静音模式下震动

    }

 

原文地址:https://www.cnblogs.com/thxios/p/6652412.html