BruceLee
DocumentDiscussion

导航

 

直接贴代码了

 

   1: public override void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info)
   2: {
   3:     //使用下面方式保存图片到你的应用程序中
   4:     UIImage image = (UIImage)info.ObjectForKey(new NSString("UIImagePickerControllerOriginalImage"));
   5:     NSData imageData = image.AsJPEG();
   6:     byte[] imageBytes = new byte[imageData.Length];
   7:     int length = (int)imageData.Length;
   8:     Marshal.Copy(imageData.Bytes, imageBytes, 0, length);
   9:     string destPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
  10:     string fileName = "picture.jpg";
  11:     string filePath = Path.Combine(destPath, fileName);
  12:     File.WriteAllBytes(filePath, imageBytes);          
  13:     picker.DismissModalViewControllerAnimated(true);
  14: }

作者:Bruce Lee
出处:http://www.cnblogs.com/BruceLee521
本博原创文章版权归博客园和本人共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出作者名称和原文连接,否则保留追究法律责任的权利。

posted on 2012-10-20 21:16  Bruce Lee  阅读(540)  评论(0编辑  收藏  举报