首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
iOS 开发实用技术导航
NSHipster 中文版
›
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
›
http://www.cocos2d-iphone.org/
CocoaPods
›
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
›
http://code.google.com/mobile/analytics/
WWDC
›
https://developer.apple.com/wwdc/
Design Guides and Resources
›
https://developer.apple.com/design/
Transcripts of WWDC sessions
›
http://asciiwwdc.com
Cocoa with Love
›
http://cocoawithlove.com/
Cocoa Dev Central
›
http://cocoadevcentral.com/
NSHipster
›
http://nshipster.com/
Style Guides
›
Google Objective-C Style Guide
›
NYTimes Objective-C Style Guide
Useful Tools and Services
›
Charles Web Debugging Proxy
›
Smore
广告
V2EX
›
iDev
关于 ALAsset 如何保存
belanote
·
2015-03-20 19:23:08 +08:00
· 2734 次点击
这是一个创建于 3386 天前的主题,其中的信息可能已经有所发展或是发生改变。
ALAsset 对象怎样才能持久化保存下来。。。我在多选完照片之后获取到每个照片的 ALAsset 对象保存在数组中,希望能把这个数组保存下来,在我退出程序后再打开 进入选择照片的页面 能够标记出我上次选中的照片
alasset
数组
保存
6 条回复
•
2015-03-24 10:20:39 +08:00
1
enjoeq
2015-03-20 20:23:30 +08:00
可以持久化这个 ALAset 数组的 representation 的 url,然后在下次打开时遍历照片的 ALAsset,对比你记录的 url 是否和照片的 url 相等,如果相等可以标记这个照片。
代码大概类似于这样吧:
if([asset.defaultRepresentation.url isEqual:url]) {
}
2
belanote
OP
2015-03-21 10:11:20 +08:00
哦? 我试试
3
belanote
OP
2015-03-21 10:11:44 +08:00
@
enjoeq
我试试
4
belanote
OP
2015-03-23 17:20:25 +08:00
@
enjoeq
亲 貌似还是不行啊 我把 url 取出来 存在数组里,写入文件就失败
5
enjoeq
2015-03-24 09:11:23 +08:00
@
belanote
你是直接保存 url 的?转成 NSString 后再保存应该是可以的吧.
6
belanote
OP
2015-03-24 10:20:39 +08:00
@
enjoeq
valueForProperty:ALAssetPropertyAssetURL 这样返回的就是 NSString 啊 这样也是失败的。。。
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
1286 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms ·
UTC 23:37
·
PVG 07:37
·
LAX 16:37
·
JFK 19:37
Developed with
CodeLauncher
♥ Do have faith in what you're doing.