我在这里有一个问题,我需要添加一个人在我的应用程序中使用coredata的细节。我需要存储一个图像还与每个人detail.and我也需要在下一个视图控制器中的表格视图中显示这些详细信息.i可以保存并显示除image之外的所有其他详细信息。我可以使用coredata保存并显示该信息吗?使用coredata保存并加载图像在我的手机画廊
-2
A
回答
0
您可以在您的Xcode项目保存图像并保存图像名称和路径的核心数据,需要
0
下面的代码
使用添加委托给你的h文件时引用它们在图像视图开照相馆
UIImagePickerController *picker=[[UIImagePickerController alloc]init];
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate=self;
[self presentViewController:picker animated:YES completion:nil];
使用该委托事件获得所选图像并将其保存到本地目录,
#pragma mark - Imagepicker delegate
- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *origImage = [info objectForKey:UIImagePickerControllerOriginalImage];
//Code to save image in local directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"];
UIImage *image = origImage.image; // origImage is my image from photo library
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:NO];
[imagePicker dismissViewControllerAnimated:YES completion:nil];
}
下面的代码
使用从画廊加载图像
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *ImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"];
UIImage *img = [UIImage imageWithContentsOfFile:ImagePath];
在这里的img你可以得到你的形象
+0
我需要从手机图库中选择图片.... – 2014-10-11 17:18:00
相关问题
- 1. JQueryMobile打开手机画廊,并选择一个图像
- 2. 使用手机的画廊为ViewPager
- 3. 保存在Android上的设备/画廊的画布图像
- 4. Android:Volley图像加载器与画廊
- 5. 加载画廊与particuler图像位置
- 6. J2ME:从服务器下载图像并在手机上保存
- 7. 摄像机意图/活动 - 避免保存到画廊
- 8. Android Studio如何在应用程序中从相机捕获的手机画廊中保存图像?
- 9. imageview从相机或画廊加载图像
- 10. HTML5强制拍摄图像并且不从画廊加载
- 11. 将图像保存到内部存储器,并会出现在画廊
- 12. CoreData - 保存/加载帮助!
- 13. 帮助加载“画廊”画廊与.load
- 14. 怎么画的图像和图像保存到手机图库中的Android
- 15. iOS图像画廊
- 16. 画廊选择保存图片,android
- 17. 将编辑的图像保存到iPhone画廊
- 18. 将viewpager中的图像保存到自定义gridview画廊
- 19. PrettyPhoto在画廊最后图像加载首先
- 20. 如何保存手机上的画布并通过手机获取图像的位置?
- 21. 加载从画廊的图像转换成gridview的
- 22. 使用picasso或通用图像加载器而不是缓存将图像存储在手机内存
- 23. 将图像保存到手机? WP7 C#
- 24. 捕获手机后保存图像ios
- 25. 加载/保存图像misorder
- 26. 如何使用VB保存并加载图像6
- 27. 如何使用ALAsset保存并重新加载图像?
- 28. 只使用defaul画廊应用程序显示我的图像
- 29. 的Android负荷图像并保存到手机
- 30. jquery - 无法获取图像加载灯箱样式的画廊
我搜索的代码,但没有得到它....ü可以帮我一个链接代码? – 2014-10-11 13:54:38