如何获取从源类型UIImagePickerControllerSourceTypeCamera的UIImagePickerController中选取的图像的图像名称(或图像扩展格式)?
答案 0 :(得分:2)
试试这个:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *imagePath = [info objectForKey:@"UIImagePickerControllerReferenceURL"];
NSString *imageName = [imagePath lastPathComponent];
}
答案 1 :(得分:1)
看看下面的代码
NSLog(@"%@",[[info[0] objectForKey:UIImagePickerControllerReferenceURL] pathExtension])//image extention
NSLog(@"%@",[[info[0] objectForKey:UIImagePickerControllerReferenceURL] pathComponents])//image name