Originalhttp://blog.csdn.net/yinqiangqiang/article/details/36177203 ThemesSoftware Development
1. Send a notification. (Take this notice as an example, notice the name: Gameovernotification. Notification Parameters: Title)
Nsnotificationcenter.defaultcenter (). Postnotificationname (object:title)
2. Add the Observer to the Viewdidload method to listen for this notification
Nsnotificationcenter.defaultcenter (). Addobserver (nil)
3. Implement the selector in 2 to hear the notification call method
Func Gameover (title:nsnotification) { var str = title. As String self.titleLable.text = str }
Reminder: The parameters in the notification invocation method here must be nsnotification, because we are sending 1 notifications.
Friendly tip: In Swift, if the logical structure of the project is not very clear general notice.
Use of notifications in Swift