{"id":22787202,"url":"https://github.com/mancongios/mcclipimage","last_synced_at":"2025-04-15T23:38:29.721Z","repository":{"id":56920230,"uuid":"172425558","full_name":"mancongiOS/MCClipImage","owner":"mancongiOS","description":"图片的处理，自定义裁剪比例，图片旋转，裁剪圆形图片, 拖拽缩放","archived":false,"fork":false,"pushed_at":"2019-07-02T10:28:26.000Z","size":2337,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-15T06:22:05.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mancongiOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-25T03:10:57.000Z","updated_at":"2023-02-22T07:25:35.000Z","dependencies_parsed_at":"2022-08-21T04:20:20.453Z","dependency_job_id":null,"html_url":"https://github.com/mancongiOS/MCClipImage","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCClipImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCClipImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCClipImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCClipImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mancongiOS","download_url":"https://codeload.github.com/mancongiOS/MCClipImage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229313615,"owners_count":18053712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T00:50:33.672Z","updated_at":"2024-12-12T00:50:34.202Z","avatar_url":"https://github.com/mancongiOS.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCClipImage\n\n[github地址](https://github.com/mancongiOS/MCClipImage)\n\n#支持功能说明\n\n * 裁切矩形图片 \n * 裁切圆形图片 \n * 裁切相册图片 \n * 裁切拍照图片 \n * 调整图片缩放 \n * 调整裁切框大小\n * 图片旋转操作 \n\n\n\n#示例图\n\n![功能说明](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/1.png)\n\n![裁切圆形图片](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/2.png)\n\n![裁切拍照/相册图片](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/3.png)\n\n![裁切框](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/4.png)\n\n![调整裁切框比例](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/5.png)\n\n![调整裁切框比例](https://github.com/mancongiOS/MCClipImage/blob/master/Resources/6.png)\n\n\n# 如何使用？\n`pod 'MCClipImage'`\n\n# 使用说明\n* 引用`import MCClipImage`\n\n* 打开编辑页面\n \n```\nlet config = MCClipImageConfig()\nconfig.clipImage = image\nlet vc = MCClipImageViewController()\nvc.delegate = self\nvc.initClipFunctionWithConfig(config)\nself.present(vc, animated: true, completion: nil)\n```\n\n* 获取编辑的图片\n实现MCClipImageViewControllerDelegate的代理方法\n\n```\n//点击了取消按钮\n@objc optional func clipImageViewControllerDidCancel(_ viewController: MCClipImageViewController)\n    \n// 裁切完成\nfunc clipImageViewController(_ viewController: MCClipImageViewController, didFinishClipingImage image:UIImage)\n```\n\n# 对配置类MCClipImageConfig的说明\n\n```\npublic class MCClipImageConfig: NSObject {\n    \n    /// 待裁切的图片\n    public var clipImage: UIImage?\n    /// 想要的裁切比例\n    public var clipScale: CGFloat = 2\n    /// 是否裁切圆形\n    public var isClipRound: Bool = false\n    /// 覆盖层的背景颜色\n    public var overlayBackgroundColor =  UIColor.black\n    /// 裁切框的颜色\n    public var clipBoxColor =  UIColor.green\n    /// 裁切框的宽度\n    public var clipBoxWidth: CGFloat =  1\n\n    /// 重设裁切比例的数组 （数组为空，隐私该按钮）\n    public var clipScaleType: [MCClipImageScaleType] = []\n}\n```\n\n# 裁切相册/拍照图片\n\n* 初始化\n\n```\n    lazy var helper: MCPickerImageHelper = {\n        let helper = MCPickerImageHelper()\n        return helper\n    }()\n```\n\n**MCPickerImageHelper，如果声明为局部对象的话，走完就被销毁了。但是MCPickerImageHelper对象又作为n内部pickerViewController的代理执行者，执行者没了，所以就不响应pickerViewController的代理方法。 所以一定不能让MCPickerImageHelper对象被销毁，要么懒加载该对象要么成为全局的。**\n* 开启\n\n```\n // 开启相册\n helper.openPhotoLibrary(self)\n // 开启拍照\n helper.openCamera(self)\n```\n\n* 实现代理方法\n\n```\n@objc optional func pickerImageHelperDidCancel(_ picker: MCPickerImageHelper)\n    \nfunc pickerImageHelper(_ picker: MCPickerImageHelper, didFinishPickImage image:UIImage)\n```\n\n# 更详细的使用请看demo\n[github地址](https://github.com/mancongiOS/MCClipImage)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcclipimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmancongios%2Fmcclipimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcclipimage/lists"}