sách gpt4 ai đã đi

IOS- NSNotificationCenter- 通知特定实例

In lại 作者:行者123 更新时间:2023-11-29 10:56:15 29 4
mua khóa gpt4 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 我没有能力这样做。

任何想法都会很棒!

Cảm ơn trước nhé!

1 Câu trả lời

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

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

29 4 0
Bài viết được đề xuất: iOS:UITableViewController——cellForRowAtIndexPath 单元格创建
Bài viết được đề xuất: IOS 搜索键盘慢
Bài viết được đề xuất: iphone - AppStore更新后神秘的应用程序崩溃
Bài viết được đề xuất: ios - 同时支持 iOS5 和 iOS6
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com