Swift:KVO

2022-07-05  本文已影响0人  ChaosHeart
//发送KVO通知
 NotificationCenter.default.post(name: NSNotification.Name(rawValue: "work_number"), object: nil);
//监听KVO通知
                NotificationCenter.default.addObserver(self, selector: #selector(listenerWorkNumber), name:NSNotification.Name(rawValue: "work_number"), object: nil);


 ///监听用户进入首页将工号穿来
    @objc func listenerWorkNumber() {
        UIApplication.shared.registerForRemoteNotifications();
    }
上一篇 下一篇

猜你喜欢

热点阅读