某图片添加控件:

https://github.com/XZTLLQ/LQPhotoPickerDemo

问题:

标题已说明

代码块:

NSArray *alAssetUrl =(NSMutableArray *)[HiddenRecordDataService getLocalImageSystemFilePath:_hiddenDangerInfoLocalModel.HiddenDangerInfoLocalId];
NSMutableArray *localASSetArray = [NSMutableArray arrayWithCapacity:];
for (NSURL *url in alAssetUrl) {
NSLog(@"url:%@", url);
ALAssetsLibrary* library = [[ALAssetsLibrary alloc]init];
// library fetch
[library assetForURL:url resultBlock:^(ALAsset *asset) {
if (asset) {
[localASSetArray addObject:asset];
} else {
// On iOS 8.1 [library assetForUrl] Photo Streams always returns nil. Try to obtain it in an alternative way
}
} failureBlock:^(NSError *error) {
iToast *itoast = [iToast makeText:@"获取图片失败"];
[itoast show];
}];
}

问题是由于标红代码导致,这里的ALAssetsLibrary对象需要用单例

代码如下:

NSArray *alAssetUrl =(NSMutableArray *)[HiddenRecordDataService getLocalImageSystemFilePath:_hiddenDangerInfoLocalModel.HiddenDangerInfoLocalId];

    NSMutableArray *localASSetArray = [NSMutableArray arrayWithCapacity:];

    for (NSURL *url in alAssetUrl) {
NSLog(@"url:%@", url);
//ALAssetsLibrary* library = [[ALAssetsLibrary alloc]init];
ALAssetsLibrary* library = [HiddenRecordViewController defaultAssetsLibrary];
// library fetch
[library assetForURL:url resultBlock:^(ALAsset *asset) {
if (asset) {
[localASSetArray addObject:asset];
} else {
// On iOS 8.1 [library assetForUrl] Photo Streams always returns nil. Try to obtain it in an alternative way
} } failureBlock:^(NSError *error) {
iToast *itoast = [iToast makeText:@"获取图片失败"];
[itoast show];
}]; }
defaultAssetsLibrary代码:
+ (ALAssetsLibrary *)defaultAssetsLibrary {
static dispatch_once_t pred = ;
static ALAssetsLibrary *library = nil;
dispatch_once(&pred, ^{
library = [[ALAssetsLibrary alloc] init];
});
return library;
}
 

关于IOS某图片添加控件,图片从相册或拍照保存后,再次进入时点击放大图无法显示的问题的更多相关文章

  1. Android开发技巧——定制仿微信图片裁剪控件

    拍照--裁剪,或者是选择图片--裁剪,是我们设置头像或上传图片时经常需要的一组操作.上篇讲了Camera的使用,这篇讲一下我对图片裁剪的实现. 背景 下面的需求都来自产品. 裁剪图片要像微信那样,拖动 ...

  2. MFC入门(三)-- MFC图片/文字控件(循环显示文字和图片的小程序)

    惯例附上前几个博客的链接: MFC入门(一)简单配置:http://blog.csdn.net/zmdsjtu/article/details/52311107 MFC入门(二)读取输入字符:http ...

  3. 用MVVM模式开发中遇到的零散问题总结(5)——将动态加载的可视元素保存为图片的控件,Binding刷新的时机

    原文:用MVVM模式开发中遇到的零散问题总结(5)--将动态加载的可视元素保存为图片的控件,Binding刷新的时机 在项目开发中经常会遇到这样一种情况,就是需要将用户填写的信息排版到一张表单中,供打 ...

  4. Android微信九宫格图片展示控件

    版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/214 Android微信九宫格图片展示控件 半年前,公司产 ...

  5. C# 使用PictureBox实现图片按钮控件

    引言 我们有时候会在程序的文件夹里看见一些图标,而这些图标恰好是作为按钮的背景图片来使用的.鼠标指针在处于不同状态时,有"进入按钮"."按下左键"," ...

  6. UI-UIImageView的图片填充方式(contentMode)_图片作为控件背景图的拉伸方式(stretch)介绍

    常用图片填充方式 这里只介绍三个最常用的图片填充方式 UIViewContentModeScaleToFill模式会导致图片变形.例如: UIViewContentModeScaleAspectFit ...

  7. 我写的一个 Qt 显示图片的控件

    Qt 中没有专门显示图片的控件.通常我们会使用QLabel来显示图片.可是QLabel 显示图片的能力还是有点弱.比方不支持图像的缩放一类的功能.使用起来不是非常方便. 因此我就自己写了个简单的类. ...

  8. Winform中Picture控件图片的拖拽显示

    注解:最近做了一个小工具,在Winform中对Picture控件有一个需求,可以通过鼠标从外部拖拽图片到控件的上,释放鼠标,显示图片! 首先你需要对你的整个Fom窗口的AllowDrop设置Ture ...

  9. 图片剪裁控件——ClipImageView

    这段时间在做自己的项目时,须要使用到图片剪裁功能,当时大概的思考了一些需求.想到了比較简单的实现方法.因此就抽了点时间做了这个图片剪裁控件--ClipImageView 这里先贴上ClipImageV ...

随机推荐

  1. Restful API 的设计规范(转)

    1. URI URI 表示资源,资源一般对应服务器端领域模型中的实体类.URI规范 不用大写; 用中杠-而不用下杠_; 参数列表要encode; URI中的名词表示资源集合,使用复数形式; 资源集合与 ...

  2. 学了编译原理能否用 Java 写一个编译器或解释器?

    16 个回答 默认排序​ RednaxelaFX JavaScript.编译原理.编程 等 7 个话题的优秀回答者 282 人赞同了该回答 能.我一开始学编译原理的时候就是用Java写了好多小编译器和 ...

  3. 单因素方差分析(One Way ANOVA)

    Analysis of variance (ANOVA) is a collection of statistical models and their associated estimation p ...

  4. java.lang.NoClassDefFoundError: com.sap.conn.jco.JCo (initialization failure) java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path

    java.lang.NoClassDefFoundError: com.sap.conn.jco.JCo (initialization failure) at java.lang.J9VMInter ...

  5. 在Asp.Net中使用jQueryEasyUI(转)

    最近做一个小工具,列表显示页面准备使用jQuery的UI框架,因为之前知道有jQWidgets这个框架,所以直接就下载下来使用了,jQWidgets的功能很强大,Demo和文档也非常详细,但使用后发现 ...

  6. 用非递归、不用栈的方法,实现原位(in-place)的快速排序

    大体思路是修改Partition方法将原本枢数的调整放到方法结束后去做.这样因为数组右侧第一个大于当前枢数的位置就应该是未划分的子数组的边界.然后继续进行Partition调整.这种写法照比递归的写法 ...

  7. Combination Sum II leetcode java

    题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combination ...

  8. ElasticSearch客户端注解使用介绍

    The best elasticsearch highlevel java rest api-----bboss 1.ElasticSearch客户端bboss提供了一系列注解 @ESId  用于标识 ...

  9. 谷歌(Google)被墙,解决地图和字体无法显示的问题

    首先,本文以及本站所有文章都是技术探讨文章,不鼓励任何人去fan qiang以及做任何违法的事情.接下来是正文: 谷歌基本上是被和谐透了,谷歌地图API自然也打不开了,于是公司网站上那些谷歌地图都变成 ...

  10. OpenGL® ES 3.0 Programming Guide - Book Website

    OpenGL® ES 3.0 Programming Guide - Book Website http://opengles-book.com sample codes in GitHub: htt ...