如何检查所选图像是全景图像还是非图像 [英] How to check a image selected is Panorama image or Not
本文介绍了如何检查所选图像是全景图像还是非图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查,从 UIImagePickerController
中选择的图像是不是全景图像?
How to check, the image selected from UIImagePickerController
is a Panorama Image or not?
推荐答案
在这个 UIImagePickerController
委托方法中(确保将委托方法添加到View Controller类中):
In this UIImagePickerController
delegate method (be sure to add delegate methods to your View Controller class):
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:NULL];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
// determine if it's panorama by checking its dimension
CGFloat imageWidth = image.size.width;
CGFloat imageHeight = image.size.height;
// display the image if needed
[self.imageView setImage:image];
self.imagePickerController = nil;
}
理论上,全景图像的宽度比普通图像长得多。但这无法检查它是否是从其他地方下载的网络图像。
Theoretically panorama images have much longer width than normal image. But this can't check if it is a web image downloaded from elsewhere.
这篇关于如何检查所选图像是全景图像还是非图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文