我在这里迷路了。 我尝试使用这个方法来初始化一个 UIIMage 对象。 我知道它看文件目录等等,而不是缓存...
I provide respective URLs or paths but the object is always nil. The method is never succesful. Is it because my paths always contain the file prefix at the beginning? Like this?
file:// .somedir/somedir/etc.../fieldname.jpg /fieldname.jpg 。
我通过获取此电话的 docs 目录创建路径
//get the documents directory path
NSURL *docsPath = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
// create the full image local path
NSString *imageLocalPath = [NSString stringWithFormat:@"%@%u.jpg", docsPath, indexPath.row + 1];
然后构建路径字符串。