第一讲:iOS概述
来源:互联网 发布:网络域名 编辑:程序博客网 时间:2024/06/08 13:11
一、什么是iOS?
1、Core OS(核心操作系统层),这是很接近硬件的一层,是一个Unix内核;
2、Core Services(核心服务层),这是之上的面向对象的一层
3、Media(媒体层)
4、Cocoa Touch(UI层)
二、Platform Components(平台组件)
1、Tools:Xcode、Instrument(用于app代码分析,内存管理等)
2、Language:Objective-c
3、Frameworks:Foundation,所有核心服务都在这里(例如数组、字典);UIKit(例如按钮、滑动条);Core Data,面向对象的数据库;Core Motion是陀螺仪和加速计;Map Kit显然是地图
三、设计策略(MVC)
1、controller -> model:controller需要知道model的一切,还要有同model完全通信的能力。因为controller就是将model呈现给用户。controller需要能够完全、不受限制地访问model。
2、controller -> view:view是controller的仆从,来布局用户界面这些。controller到view,通信也是不受限的。因为controller需要随意使唤自己的仆从。controller可以做任何事情。 outlet(出口):创建一个controller到view的outlet,这样controller就能同view通信。
3、model <-> view:从不,模型完全独立于UI。
4、model -> controller:这不允许,因为model对UI一无所知。有时,model中的数据发生变化,controller需要知道它(例如数据变化、数据库变化),这时就用到了notification和KVO。model发出通知,controller知道了model发生了变化,会让model把变化的数据给它。
5、view -> controller
1>target、action;
2>will、should、did(代理、协议)
3>view中不会存储数据,view通过controller从model获取dataSource(其实是一种委托)。
四、strong和weak
Strong means keep the memory(内存) for this,for the thing this points to,in the heap(堆),as long as I or anyone else has a strong pointer to it.So, this is called reference counting(这被叫作引用计数).
If you have a weak pointer,that tells objective-C, I have a pointer to this thing in the heap and keep it in memory as long as someone else has a strong pointer to it.But as soon as no one else has a strong pointer to that thing, it gets freed from memory.And this pointer, if it was weak,gets set to nil.Nil means this pointer doesn't point to anything.Nil is the same as zero.In objective-C,you can send message to nil pointers even and it will not crash your program.
五、nonatomic
Nonatomic means calling this setter and getter that go along with this property is not thread(线程) safe.So you can't have two threads trying to set this property at the same time.The way we do multithreading(多线程) is iOS,is not by having a single object that multiple threads are setting on(不是一个对象上多个线程在设置),we usually have a separate set of objects(另外一组对象) that are running in another thread,like your model.UI stuff(UI这些东西) is running in the UI thread,and they're talking thread to thread.
- 第一讲:iOS概述
- 第一讲 MFC概述
- 第一讲:JavaMail概述
- 第一讲--概述
- 第一讲 javascript概述
- 第一讲:操作系统概述
- 第一讲 Java语言概述
- 第一讲 Java语言概述
- 第一讲 Java语言概述
- 第一讲 Java语言概述
- 【c#】第一讲:概述和规则
- 第一讲 visual c++6.0概述
- 第一讲:计算机网络概述(上)
- iOS基础_C语言第一讲
- OLE技术专题——第一讲:OLE概述
- XML第一讲:XML概述、编写XML文档
- 【Java教程】第一讲 Java语言概述(1)
- 【Java教程】第一讲 Java语言概述(2)
- 1005. Spell It Right (20)
- 【Linux网络】Linux Socket编程 TCP协议
- 磁盘分区
- 魔方动态壁纸android源码下载
- 改善javascript 性能
- 第一讲:iOS概述
- C语言变长数组 struct中char data[0]的用法
- 智能家居开发-android 蓝牙4.0 开发经验分享
- Android UI中视图不同状态时显示不同外观
- nginx使用ssl模块配置HTTPS支持
- 绘画学习过程记录
- 如何调试bug
- AsyncTask异步更新UI界面以及原理
- 游戏免费的服务器使用