美文网首页
swift通知使用

swift通知使用

作者: 智能居家 | 来源:发表于2017-07-07 17:47 被阅读90次

1.声明的控制器  

NotificationCenter.default.post(name:Notification.Name(rawValue:XMGPopoverAnimatorWilldismiss), object:self)

2.使用的控制器

注册通知,监听菜单

NotificationCenter.default.addObserver(self, selector:#selector(HomeTableViewController.change), name:NSNotification.Name(rawValue:XMGPopoverAnimatorWillShow), object:nil)

funcchange()

{

//被调用的方法

}

3.离开控制器后销毁通知

//移除通知

NotificationCenter.default.removeObserver(self)

相关文章

网友评论

      本文标题:swift通知使用

      本文链接:https://www.haomeiwen.com/subject/orlrhxtx.html