---
title: "各种函数"
author: "mlkimg"
date: "2011-04-21T01:03:04Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2011-04-21T02:41:02Z"
id: 1010669
url: "https://mlkimg.iteye.com/blog/1010669"
---

1、保存图片到相册（有camera roll保存到camera roll）

UIImageWriteToSavedPhotoAlbum(

UIImage \*image,

id completionTarget,

SEL completionSelector,

void \*contextInfo

);

注：contextInfo是任意指针，一般是完成后调用方法时使用，或在完成时出错时的处理。

 

2、播放系统声音

#import &lt;AudioToolbox/AudioToolbox.h&gt;

NSURL \*filePath   = \[\[NSBundle mainBundle] URLForResource:   @"pageflip" withExtension: @"aif"]; 

AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);

AudioServicesPlaySystemSound(soundID);

支持的格式：

alf

caf

wav