标签:
iOS中的MVC(Model-View-Controller)将软件系统分为Model、View、Controller三部分,结构图如下:
1 let center = NSNotificationCenter.defaultCenter() 2 3 center.addObserverForName(UIContentSizeCategoryDidChangeNotification, 4 object: UIApplication.sharedApplication(), 5 queue: NSOperationQueue.mainQueue()) 6 { notification in 7 let c = notification.userInfo?[UIContentSizeCategoryNewValueKey] 8 }
KVO:
1 webView.addObserver(self, forKeyPath: "estimatedProgress", options: .New, context: nil) 2 3 override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [NSObject : AnyObject]?, context: UnsafeMutablePointer<Void>) { 4 if (keyPath == "estimatedProgress") { 5 progressView.hidden = webView.estimatedProgress == 1 6 progressView.setProgress(Float(webView.estimatedProgress), animated: true) 7 } 8 }
标签:
原文地址:http://www.cnblogs.com/cy568searchx/p/5955763.html