gpt4 book ai didi

IOS- NSNotificationCenter- 通知特定实例

转载 作者:行者123 更新时间:2023-11-29 10:56:15 28 4
gpt4 key购买 nike

我正在使用 NSNotificationCenter,监听器使用以下代码订阅:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(editRSSLAbel:)
name:@"editLabel"
object:nil];

发件人发送带有此帖子的通知:

NSDictionary *dataDict = [NSDictionary dictionaryWithObject:@"http://www.nba.com" forKey:@"link"];                                               

[[NSNotificationCenter defaultCenter] postNotificationName:@"editLabel" object:self userInfo:dataDict];

但是,我想通知一个特定的 viewController instance,而使用上面的 machinisem 我没有能力这样做。

任何想法都会很棒!

提前致谢!

最佳答案

Apple 不直接支持这个,你可以用你的应用程序注册这个通知,而不是你的 View ,操作系统不熟悉你的内部实现,所以你可以添加一个带有 Controller 名称的字典并保存一个字典names-controllers 将其转发到正确的 View

关于IOS- NSNotificationCenter- 通知特定实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18248572/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com