OC编程|OC Swift NotificationCenter通知

NotificationCenter.default.addObserver(self, selector: #selector(sendAddCategory), name: NSNotification.Name(rawValue: "SendAddCategory"), object: nil)`

【OC编程|OC Swift NotificationCenter通知】@objc func sendAddCategory(notification:Notification){ let userInfo = notification.userInfo as! [String: AnyObject] let catagoryStr = userInfo["categoryStr"] as! String let catagoryId = userInfo["categoryId"] as! NSNumber }
[[NSNotificationCenter defaultCenter] postNotificationName:@"SendAddCategory" object:nil userInfo:@{@"categoryStr":categoryStr,@"categoryId" : [NSNumber numberWithInteger:categoryId]}];

    推荐阅读