Objective C中MVC的问题
在目标 c 中,遵循 MVC 模式,我们有: - VIEW = UIView 子类 - CONTROLLER = UIViewController 子类 - MODEL = tableview ecc 的数据,
而不是进行操作和计算我们的数据可以插入哪个类别的通用类?模型?或者还有什么?
in objective c, following MVC pattern we have:
- VIEW = UIView subclass
- CONTROLLER = UIViewController subclass
- MODEL = data for tableview ecc
instead generic classes that make operations and compute our data in which category can be inserted? MODEL? or what else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
模型类不仅仅是表视图背后的数据,它们是对您想要解决的问题进行建模的所有类。
The model classes are not just the data behind the table view, they are all the classes modeling the problem you want to solve.
你是问什么类可以用作模型对象?有相当多... NS[Mutable]Dictionary、NS[Mutable]Array、NS[Mutable]Set、NS[Mutable]String、NSManagedObject 等等。 NSFetchedResultsController 和 NSManagedObjectContext 都适合某种模型控制器角色。但通常情况下,应用程序功能的很大一部分都在模型中,因此管理数据的对象成为您自己创建的类是有意义的。
Are you asking what classes can be used as model objects? There are quite a few... NS[Mutable]Dictionary, NS[Mutable]Array, NS[Mutable]Set, NS[Mutable]String, NSManagedObject, and so on. NSFetchedResultsController and NSManagedObjectContext both fit into a sort of model controller role. Often, though, a significant portion of your application's functionality is in the model, and it makes sense for the object that manages the data to be a class of your own creation.