iOS:什么是Objective-C中的事件监听器? [英] iOS: what is the equivalent of an event listener in Objective-C?

查看:80
本文介绍了iOS:什么是Objective-C中的事件监听器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一些学习中,我看到有人提到在视图控制器中你可以拥有一个模型,并在模型上有一些监听器来进行更改。我不认为我正在使用正确的名称,这可能是我的搜索没有出现任何原因的原因。基本上我想将我的服务器调用从控制器移动到我的模型中,但是我需要某种监听器才能知道调用何时完成以更新我的视图。

In some of my learning I saw someone mention that in your view controller you can have a model and have some sort of listener on the model for changes in it. I don't think I'm using the right names for these, which is probably why my searches haven't turned up anything. Essentially I want to move my server calls from the controllers into my models, but I need some sort of listener on them to know when the call is complete to update my views.

推荐答案

调查代表
委托教程

或阻止更高级的
基本块教程

刚从代表开始,

您还可以使用NSNotification NSNotification教程但不建议将其广播到每个班级,您可能只需要向特定班级发送消息而不是每个班级

you can also use NSNotification NSNotification tutorial but is not recommended as it broadcast to every class, and you might only need to send messages to a specific class not every one

这篇关于iOS:什么是Objective-C中的事件监听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆