gpt4 book ai didi

iOS编程。如何从电话簿应用程序的电话中获取图片

转载 作者:行者123 更新时间:2023-11-29 12:39:11 24 4
gpt4 key购买 nike

我需要您的帮助/引用/提示,了解如何从 1) 我在 iPhone 中的画廊和 2) 从 iPhone 前置摄像头获取图片。这样我的程序就可以将这张图片复制到它在 iPhone 上的本地文件夹中(不只是引用图库)。谢谢

最佳答案

您可能会在 this appple developer doc 上找到信息有用。您使用 UIImagePickerController 来呈现模态视图,如下面的代码所示,来自上面的文档。

- (BOOL) startMediaBrowserFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate {

if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;

UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

// Displays saved pictures and movies, if both are available, from the
// Camera Roll album.
mediaUI.mediaTypes =
[UIImagePickerController availableMediaTypesForSourceType:
UIImagePickerControllerSourceTypeSavedPhotosAlbum];

// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
mediaUI.allowsEditing = NO;

mediaUI.delegate = delegate;

[controller presentModalViewController: mediaUI animated: YES];
return YES;
}

我确实建议您通读上面的文档,因为它提供的信息非常丰富,但不容易解释。

希望这对您有所帮助!

关于iOS编程。如何从电话簿应用程序的电话中获取图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25462461/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com