{"id":21802883,"url":"https://github.com/coderzhuxh/xhphoto","last_synced_at":"2025-09-02T22:32:49.427Z","repository":{"id":56927998,"uuid":"60519813","full_name":"CoderZhuXH/XHPhoto","owner":"CoderZhuXH","description":"一行代码搞定照片选择,支持相册/相机及设置是否裁剪","archived":false,"fork":false,"pushed_at":"2017-10-13T02:36:07.000Z","size":1047,"stargazers_count":52,"open_issues_count":8,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T09:40:47.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/CoderZhuXH.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":"2016-06-06T10:32:00.000Z","updated_at":"2022-05-03T06:22:53.000Z","dependencies_parsed_at":"2022-08-21T06:20:26.316Z","dependency_job_id":null,"html_url":"https://github.com/CoderZhuXH/XHPhoto","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/CoderZhuXH%2FXHPhoto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHPhoto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHPhoto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHPhoto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoderZhuXH","download_url":"https://codeload.github.com/CoderZhuXH/XHPhoto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765983,"owners_count":21158296,"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-11-27T11:34:01.012Z","updated_at":"2025-04-13T18:51:33.139Z","avatar_url":"https://github.com/CoderZhuXH.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XHPhoto\n* 一行代码搞定照片选择,支持相册/相机及设置是否裁剪\n\n[![AppVeyor](https://img.shields.io/appveyor/ci/gruntjs/grunt.svg?maxAge=2592000)](https://github.com/CoderZhuXH/XHPhoto)\n[![Version Status](https://img.shields.io/cocoapods/v/XHPhoto.svg?style=flat)](http://cocoadocs.org/docsets/XHPhoto)\n[![Support](https://img.shields.io/badge/support-iOS%207%2B-brightgreen.svg)](https://github.com/CoderZhuXH/XHPhoto)\n[![Pod Platform](https://img.shields.io/cocoapods/p/XHPhoto.svg?style=flat)](http://cocoadocs.org/docsets/XHPhoto/)\n[![Pod License](https://img.shields.io/cocoapods/l/XHPhoto.svg?style=flat)](https://github.com/CoderZhuXH/XHPhoto/blob/master/LICENSE)\n\n\n### 技术交流群(群号:537476189).\n\n## 效果\n![image](http://c.hiphotos.baidu.com/image/pic/item/4afbfbedab64034fa246e436a7c379310a551d72.jpg)\n## 使用方法\n#### 导入UIViewController+XHPhoto.h头文件,在控制器中调用\n\n#### 1.使用系统UIActionSheet来选择打开相机、相册\n\n```objc\n\n    //edit:照片需要裁剪:传YES,不需要裁剪传NO(默认NO)\n    [self showCanEdit:YES photo:^(UIImage *photo) {\n        \n    //TO TO...\n        \n    }];\n\n```\n\n#### 2.直接打开相机\n\n```objc\n    //edit:照片需要裁剪:传YES,不需要裁剪传NO(默认NO)\n    [self showCameraCanEdit:YES photo:^(UIImage *photo) {\n        \n\t\t//TO TO...\n\t\t\n    }];\n\n```\n\n#### 3.直接打开相册\n\n```objc\n\n    //edit:照片需要裁剪:传YES,不需要裁剪传NO(默认NO)\n    [self showPhotoLibraryCanEdit:YES photo:^(UIImage *photo) {\n        \n\t\t//TO TO...\n\t\t\n    }];\n\n```\n## 注意\n\n*\t请在info.plist中添加\n*\tPrivacy - Photo Library Usage Description\n*\tPrivacy - Camera Usage Description\n\n## Tips\n*  将Info.plist   `Localization native development region`  值 设置 `china`  相册及相机界面即显示为中文\u003cbr\u003e\n\n##  安装\n### 手动添加:\u003cbr\u003e\n*   1.将 XHPhoto 文件夹添加到工程目录中\u003cbr\u003e\n*   2.导入 UIViewController+XHPhoto.h.h\n\n### CocoaPods:\u003cbr\u003e\n*   1.在 Podfile 中添加 pod 'XHPhoto'\u003cbr\u003e\n*   2.执行 pod install 或 pod update\u003cbr\u003e\n*   3.导入 UIViewController+XHPhoto.h.h\n\n### Tips\n*   1.如果发现pod search XHLaunchAd 搜索出来的不是最新版本，需要在终端执行cd ~/desktop退回到desktop，然后执行pod setup命令更新本地spec缓存（需要几分钟），然后再搜索就可以了\n*   2.如果你发现你执行pod install后,导入的不是最新版本,请删除Podfile.lock文件,在执行一次 pod install\n*   3.如果在使用过程中遇到BUG，希望你能Issues我，谢谢（或者尝试下载最新的代码看看BUG修复没有）\n\n##  系统要求\n*   该项目最低支持 iOS 7.0 和 Xcode 7.0\n\n##  许可证\nXHPhoto 使用 MIT 许可证，详情见 LICENSE 文件","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderzhuxh%2Fxhphoto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderzhuxh%2Fxhphoto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderzhuxh%2Fxhphoto/lists"}