如何在UIImageView
中显示图像
documentsDirectoryURL.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByAppendingPathComponent("img"))
例如,像这样
imageView.image = UIImage(documentsDirectoryURL.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByAppendingPathComponent("img")))
这是我的documentDirectoryURL
let documentsDirectoryURL = NSFileManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first as! NSURL
答案 0 :(得分:1)
试试这个
imageView.image = UIImage(contentsOfFile: documentsDirectoryURL.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!.URLByAppendingPathComponent("img")).path)
祝你好运