NSNotificationCenter没有在swift2.2中调用

时间:2016-06-08 07:30:27

标签: ios iphone swift swift2

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的新手,任何一个人都解释这个

0 个答案:

没有答案