新通知目前是否在Swift 3中有效?
我在做:
NotificationCenter.default().post(name: DidTouchParticleView, object: self.particle as? AnyObject)
Run Code Online (Sandbox Code Playgroud)
在自定义视图中touchesBegan(),我需要将particle对象发送到视图控制器(如果有).所以我这样做:
NotificationCenter.default().addObserver(forName: DidTouchParticleView,
object: self,
queue: OperationQueue.main(),
using: presentParticleDisplayView(notification:))
Run Code Online (Sandbox Code Playgroud)
在视图控制器中viewDidLoad().我确定那个特定的视图控制器是我点击我的自定义视图时显示的那个,但是,该函数presentParticleDisplayView(notification:)从未被调用过.
此外,DidTouchParticleView全局定义如下:
let DidTouchParticleView = NSNotification.Name("didTouchParticleView")
Run Code Online (Sandbox Code Playgroud)
这是由于测试版,还是我做错了什么?