// 监听通知
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #703daa }
span.s2 { color: #ba2da2 }
span.s3 { color: #3e1e81 }
span.s4 { color: #4f8187 }
NotificationCenter.default.addObserver(self, selector: #selector(LibraryAPI.downloadImage(_:)), name: NSNotification.Name(rawValue: downloadImageNotification), object: nil)
// 网络下载和主线程刷新UI
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #703daa; background-color: #fffcea }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #000000 }
span.s2 { color: #3e1e81 }
span.s3 { color: #ba2da2 }
span.s4 { color: #31595d }
span.s5 { color: #703daa }
span.s6 { color: #4f8187 }
DispatchQueue.global().async {
let image = self.xiaZaiTuPianWithUrl(imageUrl)
DispatchQueue.main.async {
myImageView?.image = image
self.persistencyManager.baoCunTuPian(image, fileName: URL(string: imageUrl)!.lastPathComponent)
}
}
// 文件本地目录
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #ba2da2 }
span.s2 { color: #3e1e81 }
span.s3 { color: #d12f1b }
let path = NSHomeDirectory() + "/Documents/\(filename)"
// 枚举
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #ba2da2 }
enum PokeType {
case normal
case fire
case water
}
// KVO
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #4f8187 }
span.s2 { color: #3e1e81 }
span.s3 { color: #ba2da2 }
span.s4 { color: #d12f1b }
myImgView.addObserver(self, forKeyPath: "image", options: [], context: nil)
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
span.s1 { color: #ba2da2 }
span.s2 { color: #703daa }
span.s3 { color: #d12f1b }
span.s4 { color: #4f8187 }
span.s5 { color: #3e1e81 }
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "image" {
indicator.stopAnimating()
}
}
//
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #703daa; background-color: #fffcea }
topViewController
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #703daa; background-color: #fffcea }
span.s1 { color: #000000 }
span.s2 { color: #272ad8 }
span.s3 { color: #ba2da2 }
span.s4 { color: #4f8187 }
(controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
// didSet
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #fffcea }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #008400; background-color: #fffcea }
span.s1 { color: #ba2da2 }
span.s2 { color: #703daa }
span.s3 { color: #000000 }
span.s4 { color: #31595d }
var detailItem: NSDate? {
didSet {
// Update the view.
configureView()
}
}
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #703daa; background-color: #fffcea }