美文网首页
iOS开发笔记-91:Swift5 - UIImagePicke

iOS开发笔记-91:Swift5 - UIImagePicke

作者: 原味蛋炒饭 | 来源:发表于2019-05-29 17:29 被阅读0次

    在使用系统图片选择器的时候,发现裁剪之后的图片有位置偏移
    这个做一个小布丁

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
       let info = convertFromUIImagePickerControllerInfoKeyDictionary(info)
      var image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.originalImage)] as? UIImage
            var crop: CGRect = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.cropRect)] as? CGRect ?? CGRect.zero
            crop.origin.y = crop.origin.y + kNavigationBar64//kNavigationBar64就是偏移量
            image = ordinaryCrop(imageToCrop: image, cropRect: crop)
    }
    

    相关文章

      网友评论

          本文标题:iOS开发笔记-91:Swift5 - UIImagePicke

          本文链接:https://www.haomeiwen.com/subject/zatutctx.html