我正在为照片制作一个 iOS 应用程序,并在我的应用程序中本地存储照片。我必须编辑一些照片。所以,我必须写很多代码来做和苹果照片应用程序完全一样的事情。除了自己编写代码之外,还有任何可能的方法可以访问 iPhone 照片应用程序,仅用于从我的应用程序进行编辑。是否可以使用扩展程序来访问照片编辑功能?提前致谢!
最佳答案
我不知道扩展是什么意思,但是您可以使用 UIImagePickerController 访问照片库(这是类引用 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/ 和示例代码 https://developer.apple.com/library/prerelease/ios/samplecode/PhotoPicker/Introduction/Intro.html )。您可以允许编辑如下
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
} else {
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
[imagePicker setAllowsEditing:YES];
[imagePicker setDelegate:self];
关于ios - 是否可以从我的应用程序访问照片编辑扩展程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28804289/