-2
由于我对iOS开发非常陌生,我试图将图像库中的uiimage添加到数组中。但是,当我尝试使用数组中添加图像的UIImageView它显示了我一个错误如何将iPhone图库中的图像添加到数组IOS
[UIImage的stringByDeletingPathExtension]:无法识别的选择发送到 实例0x7fefd3ea02f0。
choosen_Imgae = info[ UIImagePickerControllerOriginalImage];
//
// choosen_Imgae = [self resizeImage:choosen_Image];
NSLog(@"chosen image %@",choosen_Imgae);
[picker dismissViewControllerAnimated:YES completion:NULL];
NSData *dataImage = [[NSData alloc] init];
dataImage = UIImagePNGRepresentation(choosen_Imgae);
if (dataImage != nil) {
[image_Arr insertObject:choosen_Imgae atIndex:indexxpath.row];
NSLog(@"image array after adding object %@",image_Arr);
}
获取图像,您需要共享一些代码,然后我们可以帮助你。 –
从图库中提取图像并将其添加到图像数组 – ashish
您需要在数组中追加,而不是在特定索引处插入。如果你的数组被分配了固定的大小,你可以使用'insertObject:atIndex:'else use'addObject:'方法。另外请确保在使用任何这些之前,您的阵列已正确初始化。 –