ios - MVC 中应用了哪些 OOP 概念?

标签 ios design-patterns

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 9 年前

昨天我接受了 iOS 面试,面试官问,哪些 OOP 概念适用于 MVC 设计模式,对此我一无所知,谁能简单地解释一下。

最佳答案

引自 Developer.Apple.com,基本的 iOS 设计模式是:-

“无论您要创建什么类型的应用程序,在开始编写代码之前都必须了解一些基本的设计模式和技术。在 iOS 中,系统框架为您的应用程序提供了关键的基础架构,并且在大多数情况下访问底层硬件的唯一方法。反过来,框架使用许多特定的设计模式,并假设您熟悉它们。因此,了解这些设计模式是了解系统如何帮助您开发应用程序的重要的第一步。

您必须了解的最重要的设计模式是:

Model-View-Controller—This design pattern governs the overall structure of your app.

Delegation—This design pattern facilitates the transfer information and data from one object to another.

Target-action—This design pattern translates user interactions with buttons and controls into code that your app can execute.

Block objects—You use blocks to implement callbacks and asynchronous code.

Sandboxing—All iOS apps are placed in sandboxes to protect the system and other apps. The structure of the sandbox affects the placement of your app’s files and has implications for data backups and some app-related features.

准确高效的内存管理对于 iOS 应用非常重要。由于 iOS 应用程序的可用内存通常比同类台式计算机少,因此应用程序需要积极删除不需要的对象,并从一开始就懒于创建对象。应用程序使用编译器的自动引用计数 (ARC) 功能来有效管理内存。尽管不需要使用 ARC,但强烈建议使用。另一种方法是通过显式保留和释放对象来自行管理内存。”

另请阅读:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/DesignPatterns.html

编辑:

编程示例:

http://www.cs.colorado.edu/~kena/classes/5448/f12/presentation-materials/myrose.pdf

关于ios - MVC 中应用了哪些 OOP 概念?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20259211/

上一篇:ios - 无法在屏幕末尾添加工具栏

下一篇:ios - 无法以编程方式将文件从包加载到 UITextView 和 UIImageView

相关文章:

ios - 如何将两个 UILabel 添加到单个 TableView 中?

java - 如何在另一个图表中找到一个图表的 x,y 位置不同

Javascript 共享具有独特状态的通用回调

javascript - 这种语法差异有什么影响(如果有)?

Java - 学习 MVC

iphone - 在 applicationDidEnterBackground 时更新数据

如果我从 wi-fi 切换到 3g,ios https 会失败

ios - 核心数据自动保存与手动保存

ios - GHUnit 与 cocoa pod

javascript - 运行观察者模式示例时遇到问题