gpt4 book ai didi

uiimagepickercontroller - 如何判断从 didFinishPickingMediaWithInfo 返回的图像是来自相机还是相册?

转载 作者:行者123 更新时间:2023-12-03 11:05:37 25 4
gpt4 key购买 nike

我有一个 View Controller ,它需要能够从相册和相机中选择图片。对于 didFinishPickingMediaWithInfo 我只能有 1 个委托(delegate)方法,虽然我可以判断它是否是图像,但我似乎无法判断它是来自相册还是来自相机(我需要先将其保存在相册中)。信息中有什么可以帮助我区分这两者的吗?

谢谢...

最佳答案

因为UIImagePickerController传递给方法,你所要做的就是:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
if ([picker sourceType] == UIImagePickerControllerSourceTypeCamera) {
// Do something with an image from the camera
} else {
// Do something with an image from another source
}
}

关于uiimagepickercontroller - 如何判断从 didFinishPickingMediaWithInfo 返回的图像是来自相机还是相册?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7155311/

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