可以从我的应用程序访问照片编辑扩展吗



我正在为照片制作一个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];

最新更新