let imageDataDict:[String: UIImage] = ["SelectedImages": image!]
NSNotificationCenter.defaultCenter().postNotificationName("PosterImage", object: self, userInfo: imageDataDict)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(frameViewController.takeImages(_:)), name:"PosterImage", object: nil)
func takeImages(notification: NSNotification) {
if let singleImage = notification.userInfo?["SelectedImages"] as? UIImage {
// do something with your image
self.f_singlImage = singleImage
}
}
我正在开发NSNotificationCenter但它在swift 2.2中无法正常工作。我没有希望解决这个问题。我是swift的新手,任何一个人都解释这个