《Cocoa编程开发者手册》电子书下载

Cocoa编程开发者手册txt,chm,pdf,epub,mobi下载
作者:【美】 奇斯纳尔(Chisnall,D.)
出版社: 电子工业出版社
译者:霍炬等
出版年: 2013-7
页数: 804
定价: 128
装帧: 平装
ISBN: 9787121122392

内容简介 · · · · · ·

本书是关于Mac OS X上Cocoa API的指南,涵盖了从用户界面到网络编程各个方面的特性。本书共七个部分,详细叙述了核心的框架,以及其他许多用来构建丰富应用程序的组件,指出了庞大的API中最有价值的地方,指引读者进一步学习。

本书适合Mac OS X应用程序开发人员及爱好者阅读。





目录 · · · · · ·

第一部分 Cocoa概述
第1 章 Cocoa 与Mac OS X ............................................................................2
1.1 理解何时该用Cocoa ..................................................................................................2
1.1.1 Carbon ................................................................................................................3
1.1.2 Java .....................................................................................................................4
1.1.3 Cocoa .................................................................................................................5
· · · · · ·()
第一部分 Cocoa概述
第1 章 Cocoa 与Mac OS X ............................................................................2
1.1 理解何时该用Cocoa ..................................................................................................2
1.1.1 Carbon ................................................................................................................3
1.1.2 Java .....................................................................................................................4
1.1.3 Cocoa .................................................................................................................5
1.1.4 UNIX API ..........................................................................................................6
1.1.5 其他选择 ............................................................................................................7
1.2 理解Cocoa 在Mac OS X 中的角色 ..........................................................................7
1.2.1 Cocoa .................................................................................................................8
1.2.2 Quartz .................................................................................................................9
1.2.3 Core Foundation ...............................................................................................11
1.2.4 Darwin ..............................................................................................................12
1.2.5 XNU .................................................................................................................13
1.3 概览 ...........................................................................................................................14
第2 章 Cocoa 的可选语言 .............................................................................15
2.1 面向对象 ...................................................................................................................15
2.2 Objective-C ................................................................................................................17
2.2.1 Objective-C 的可选编译器 .............................................................................18
2.2.2 与Java 及C++ 的区别 ...................................................................................19
2.2.3 Objective-C 2.0 ................................................................................................21
2.3 Ruby 与Python .........................................................................................................22
2.4 小结 ...........................................................................................................................22
第3 章 使用Apple 的开发工具 ......................................................................23
3.1 获取Apple 的开发工具 ............................................................................................24
3.2 Interface Builder ........................................................................................................24
3.2.1 Outlet 与Action ...............................................................................................26
3.2.2 Cocoa 绑定 ......................................................................................................27
3.2.3 绘制简单的应用程序 ......................................................................................28
3.3 Xcode .........................................................................................................................31
3.3.1 创建简单的项目 ..............................................................................................31
3.3.2 OpenStep Bundle .............................................................................................33
3.3.3 开发样例 ..........................................................................................................34
3.3.4 不用Xcode 来编译 .........................................................................................35
3.4 Objective-C ................................................................................................................36
3.4.1 为何学习Objective-C .....................................................................................37
3.4.2 对C 的添加 .....................................................................................................37
3.4.3 异常与同步 ......................................................................................................44
3.4.4 自省 ..................................................................................................................47
3.4.5 C 中的Objective-C .........................................................................................50
3.4.6 Objective-C 2.0 ................................................................................................51
3.4.7 Block ................................................................................................................54
3.4.8 Objective-C++ ..................................................................................................56
3.5 Cocoa 规约 ................................................................................................................57
3.5.1 命名 ..................................................................................................................57
3.5.2 内存管理 ..........................................................................................................60
3.5.3 构造器与初始化器 ..........................................................................................62
3.6 小结 ...........................................................................................................................64
第二部分 Cocoa框架
第4 章 Foundation: Objective-C 基础库 ........................................................66
4.1 一般概念 ...................................................................................................................67
4.1.1 可变的 ..............................................................................................................67
4.1.2 Class Cluster ....................................................................................................67
4.2 Core Foundation 类型 ...............................................................................................71
4.3 基本数据类型 ...........................................................................................................72
4.3.1 非对象类型 ......................................................................................................72
4.3.2 字符串 ..............................................................................................................73
4.3.3 数字和值的装箱 ..............................................................................................75
4.3.4 数据 ..................................................................................................................76
4.3.5 缓存和丢弃数据 ..............................................................................................77
4.3.6 日期和时间 ......................................................................................................78
4.4 容器 ...........................................................................................................................79
4.4.1 比较和排序 ......................................................................................................79
4.4.2 原生容器 ..........................................................................................................82
4.4.3 数组 ..................................................................................................................82
4.4.4 字典 ..................................................................................................................84
4.4.5 集合 ..................................................................................................................84
4.5 枚举类型 ...................................................................................................................85
4.5.1 利用高级消息枚举 ..........................................................................................87
4.5.2 利用block 枚举 ...............................................................................................89
4.5.3 支持快速枚举 ..................................................................................................90
4.6 属性列表 ...................................................................................................................95
4.6.1 序列化 ..............................................................................................................96
4.6.2 用户默认值 ......................................................................................................98
4.7 和文件系统交互 .....................................................................................................101
4.7.1 Bundle ............................................................................................................101
4.7.2 工作区和文件管理 ........................................................................................104
4.7.3 使用路径工作 ................................................................................................106
4.7.4 文件访问 ........................................................................................................106
4.8 通知 .........................................................................................................................107
4.8.1 请求通知 ........................................................................................................108
4.8.2 发送通知 ........................................................................................................109
4.8.3 发送异步通知 ................................................................................................110
4.8.4 分布式通知 ....................................................................................................113
4.9 小结 .........................................................................................................................114
第5 章 应用程序相关概念 ............................................................................ 115
5.1 Run Loop .................................................................................................................115
5.2 应用程序和委托 .....................................................................................................122
5.3 响应者链 .................................................................................................................123
5.3.1 事件传递 ........................................................................................................124
5.3.2 目标与活动 ....................................................................................................127
5.3.3 变成首先响应者 ............................................................................................128
5.4 应用程序里的Run Loop ........................................................................................128
5.5 委托与通知 .............................................................................................................131
5.6 视图层次 .................................................................................................................134
5.6.1 窗口 ................................................................................................................134
5.6.2 视图 ................................................................................................................135
5.6.3 格子 ................................................................................................................136
5.7 总结 .........................................................................................................................137
第6 章 创建图形用户界面 ............................................................................138
6.1 位置视图 .................................................................................................................138
6.2 嵌套视图 .................................................................................................................143
6.2.1 剪裁视图 ........................................................................................................143
6.2.2 滚动视图 ........................................................................................................144
6.2.3 页签视图 ........................................................................................................145
6.2.4 分割视图 ........................................................................................................146
6.2.5 方框 ................................................................................................................147
6.3 创建视图 .................................................................................................................148
6.3.1 按钮 ................................................................................................................148
6.3.2 文本视图 ........................................................................................................150
6.3.3 数据视图 ........................................................................................................150
6.3.4 菜单 ................................................................................................................158
6.4 Cocoa 绑定 ..............................................................................................................160
6.4.1 键—值编码 ....................................................................................................160
6.4.2 键—值观测 ....................................................................................................165
6.4.3 公开绑定 ........................................................................................................168
6.4.4 通用控制器 ....................................................................................................169
6.4.5 绑定与用户默认值 ........................................................................................170
6.4.6 在Interface Builder 中使用绑定 ..................................................................170
6.5 小结 .........................................................................................................................176
第7 章 窗口与菜单 .......................................................................................177
7.1 理解窗口 .................................................................................................................178
第8 章 Cocoa 中的文本 ...............................................................................181
8.1 字符串的构建与析构 .............................................................................................182
8.2 字符串标注 .............................................................................................................184
8.3 本地化 .....................................................................................................................186
8.3.1 本地化的宏定义 ............................................................................................187
8.3.2 Strings 文件 ...................................................................................................188
8.3.3 格式字符串的本地化 ....................................................................................189
8.4 文本存储 .................................................................................................................190
8.5 理解字体 .................................................................................................................191
8.5.1 转换字体 ........................................................................................................192
8.5.2 罗列字体 ........................................................................................................196
8.6 显示文本 .................................................................................................................196
8.6.1 基本绘制 ........................................................................................................196
8.6.2 布局管理器 ....................................................................................................199
8.6.3 附件(attachment) ........................................................................................202
8.6.4 文本视图 ........................................................................................................203
8.6.5 文本控件单元 ................................................................................................204
8.7 编写自定义文本容器 .............................................................................................208
8.8 使用多个文本视图 .................................................................................................212
8.9 小结 .........................................................................................................................215
第三部分 Cocoa文档
第9 章 创建文档驱动型应用程序 .................................................................218
9.1 Cocoa 文档模型 ......................................................................................................219
9.1.1 文件类型 ........................................................................................................220
9.1.2 文档对象 ........................................................................................................223
9.2 创建应用程序骨架 .................................................................................................223
9.3 创建文档 .................................................................................................................225
9.3.1 载入窗口 ........................................................................................................225
9.3.2 建立文档模型 ................................................................................................227
9.3.3 读入和保存文档 ............................................................................................227
9.3.4 文档创建事件 ................................................................................................230
9.4 扩展Outliner ...........................................................................................................231
9.4.1 定义原生文件格式 ........................................................................................231
9.4.2 定义外部文件格式 ........................................................................................233
9.4.3 支持读入和保存 ............................................................................................236
9.5 支持撤销 .................................................................................................................241
9.5.1 注册撤销操作 ................................................................................................242
9.5.2 创建撤销组 ....................................................................................................243
9.5.3 处理撤销操作 ................................................................................................244
9.5.4 撤销用户界面 ................................................................................................244
9.6 给Outliner 增加撤销功能 ......................................................................................245
9.7 总结 .........................................................................................................................254
第10 章 Core Data ......................................................................................255
10.1 数据建模介绍 .......................................................................................................256
10.2 理解托管对象 .......................................................................................................257
10.3 属性类型 ...............................................................................................................258
10.4 创建数据模型 .......................................................................................................259
10.5 选择持久存储 .......................................................................................................267
10.5.1 内存存储 ......................................................................................................267
10.5.2 XML 存储 ....................................................................................................267
10.5.3 二进制存储 ..................................................................................................268
10.5.4 SQLite 存储 .................................................................................................268
10.5.5 自定义存储 ..................................................................................................269
10.6 存储元数据 ...........................................................................................................269
10.7 自动还原 ...............................................................................................................271
10.8 Core Data、Spotlight 与Time Machine ...............................................................272
10.9 小结 .......................................................................................................................273
第四部分 复杂用户界面
第11 章 处理结构化数据 ..............................................................................276
11.1 数据源和委托对象 ................................................................................................277
11.2 表格 ........................................................................................................................277
11.2.1 表格视图的绘制 ..........................................................................................278
11.2.2 使用排序描述符 ..........................................................................................279
11.2.3 定制表格视图 ..............................................................................................281
11.3 大纲视图 ................................................................................................................284
11.3.1 扩展Outliner 示例 ......................................................................................285
11.4 浏览器视图 ............................................................................................................297
11.4.1 浏览器视图的委托 ......................................................................................297
11.4.2 创建浏览器 ..................................................................................................298
11.5 集合视图 ................................................................................................................301
11.5.1 在集合视图中显示文件 ..............................................................................302
11.6 用新控件单元定制视图 ........................................................................................305
11.7 创建主- 从视图 ....................................................................................................308
11.7.1 作为细节视图的检视器 ..............................................................................309
11.8 小结 ........................................................................................................................313
第12 章 动态视图 ........................................................................................314
12.1 多标签视图 ...........................................................................................................314
12.2 分析视图层级结构 ...............................................................................................315
12.3 修改视图层级结构 ...............................................................................................317
12.3.1 改变视图的父元素 ......................................................................................317
12.3.2 重排视图 ......................................................................................................321
12.3.3 可拖出窗口的标签 ......................................................................................325
12.4 创建动态输入表单 ...............................................................................................329
12.4.1 用矩阵控件创建表单 ..................................................................................330
12.4.2 用自定义视图创建表单 ..............................................................................335
12.4.3 用规则编辑器创建表单 ..............................................................................339
12.5 全屏应用程序 .......................................................................................................343
12.6 小结 .......................................................................................................................345
第五部分 高级图形
第13 章 自定义视图 .....................................................................................348
13.1 图形上下文 ...........................................................................................................349
13.2 Core Graphics ........................................................................................................350
13.3 用AppKit 绘图 .....................................................................................................353
13.3.1 绘制形状 ......................................................................................................354
13.3.2 用控件单元绘制 ..........................................................................................358
13.3.3 绘制文本 ......................................................................................................366
13.3.4 创建新控件单元 ..........................................................................................371
13.3.5 绘制位图 ......................................................................................................375
13.3.6 组合图像 ......................................................................................................380
13.4 打印与视图分页 ...................................................................................................382
13.4.1 打印信息 ......................................................................................................382
13.4.2 创建打印任务 ..............................................................................................383
13.4.3 视图分页 ......................................................................................................385
13.4.4 自动分页 ......................................................................................................391
13.5 用调板扩展Interface Builder ...............................................................................392
13.6 小结 .......................................................................................................................399
第14 章 声音与视频 .....................................................................................400
14.1 提示音 ...................................................................................................................400
14.2 播放简单的声音 ...................................................................................................401
14.3 理解Cocoa 的影片对象 .......................................................................................405
14.4 加上视频 ...............................................................................................................408
14.5 编辑媒体 ...............................................................................................................411
14.6 低层声音API ......................................................................................................412
14.7 录音和录像 ...........................................................................................................414
14.8 支持语音 ...............................................................................................................417
14.9 Cocoa 语音合成 ....................................................................................................418
14.10 跟用户交谈 .........................................................................................................419
14.11 总结 ......................................................................................................................424
第15 章 高级视觉效果 .................................................................................425
15.1 简单的动画 ...........................................................................................................425
15.2 Core Animation 综述 .............................................................................................427
15.2.1 在图层里绘画 ..............................................................................................428
15.2.2 设置图层的内容 ..........................................................................................431
15.3 理解动画的概念 ...................................................................................................432
15.4 加上简单动画 .......................................................................................................434
15.5 图像滤镜 ...............................................................................................................437
15.6 定义过渡 ...............................................................................................................443
15.7 创建复杂的动画 ...................................................................................................445
15.8 Core Animation 三维变换 .....................................................................................446
15.9 OpenGL 与Cocoa 视图 ........................................................................................450
15.10 Quartz 合成器 ......................................................................................................453
15.11 总结 ......................................................................................................................454
第16 章 支持PDF 和HTML ........................................................................455
16.1 AppKit 里的HTML...............................................................................................456
16.2 高级HTML 支持 ..................................................................................................458
16.2.1 WebKit 综述 ................................................................................................459
16.2.2 WebView 委托 ............................................................................................460
16.2.3 编辑HTML .................................................................................................461
16.3 WebKit 的动态接口 ..............................................................................................465
16.4 PDF 和Quartz .......................................................................................................471
16.5 显示PDF ..............................................................................................................472
16.5.1 理解PDF 标注 ............................................................................................476
16.5.2 设置文档的元数据 ......................................................................................479
16.5.3 编辑PDF .....................................................................................................480
16.6 小结 .......................................................................................................................484
第六部分 用户界面集成
第17 章 搜索与过滤 .....................................................................................486
17.1 维护文档索引 .......................................................................................................487
17.1.1 创建索引 ......................................................................................................487
17.1.2 对文档索引 ..................................................................................................489
17.1.3 搜索一个索引 ..............................................................................................490
17.2 显示搜索栏 ...........................................................................................................492
17.3 搜索文档 ...............................................................................................................493
17.4 Spotlight .................................................................................................................503
17.4.1 监视文件系统事件 ......................................................................................503
17.4.2 为元数据编制索引 ......................................................................................504
17.4.3 创建元数据导入插件 ..................................................................................506
17.4.4 用Spotlight 搜索 .........................................................................................511
17.4.5 Spotlight 的局限性 ......................................................................................514
17.5 断言 .......................................................................................................................515
17.5.1 断言语言 ......................................................................................................515
17.5.2 直接创建断言 ..............................................................................................517
17.5.3 使用断言 ......................................................................................................519
17.5.4 显示断言编辑器 ..........................................................................................520
17.6 Quick Look ............................................................................................................523
17.6.1 预览包 ..........................................................................................................524
17.6.2 实现Quick Look 插件 ................................................................................524
17.7 小结 .......................................................................................................................526
第18 章 联系人、日历和私密信息 ...............................................................528
18.1 地址簿概述 ...........................................................................................................529
18.1.1 一般概念 ......................................................................................................529
18.1.2 集合类 ..........................................................................................................530
18.2 获取联系人的信息 ...............................................................................................532
18.3 检索地址簿 ...........................................................................................................535
18.4 填写“ 我” vCard ....................................................................................................536
18.5 在地址簿里增加联系人 .......................................................................................538
18.6 保存私密信息 .......................................................................................................538
18.7 日历 .......................................................................................................................547
18.7.1 日历存储区的概念 ......................................................................................548
18.7.2 存取事件 ......................................................................................................549
18.7.3 新建日历 ......................................................................................................552
18.8 同步数据 ...............................................................................................................553
18.8.1 使用Apple 的纲要 ......................................................................................554
18.9 小结 .......................................................................................................................560
第19 章 剪贴板 ............................................................................................561
19.1 剪贴板概览 ...........................................................................................................561
19.2 剪贴板类型 ...........................................................................................................564
19.3 对类型进行过滤 ...................................................................................................566
19.4 属性列表数据 .......................................................................................................567
19.5 自编码对象 ...........................................................................................................567
19.6 文件和剪贴板 .......................................................................................................568
19.7 复制和粘贴 ...........................................................................................................569
19.8 拖动和投放 ...........................................................................................................571
19.8.1 拖动操作 ......................................................................................................572
19.8.2 投放操作 ......................................................................................................574
19.8.3 在自定义视图中实现拖放 ..........................................................................575
19.9 拖放和数据视图 ...................................................................................................582
19.10 小结 .....................................................................................................................588
第20 章 服务 ...............................................................................................589
20.1 服务示例 ...............................................................................................................589
20.2 一个计算服务 .......................................................................................................591
20.3 使用服务 ...............................................................................................................597
20.4 控制服务菜单 .......................................................................................................599
20.5 过滤器服务 ...........................................................................................................600
20.6 小结 .......................................................................................................................601
第21 章 增加脚本支持 .................................................................................602
21.1 脚本概览 ...............................................................................................................602
21.1.1 AppleScript 对象模型 ..................................................................................604
21.1.2 脚本词汇表 ..................................................................................................604
21.2 将对象脚本化 .......................................................................................................605
21.2.1 理解AppleScript 对象 ................................................................................606
21.2.2 提供对象指示符 ..........................................................................................607
21.2.3 提供一个脚本定义 ......................................................................................609
21.2.4 处理脚本命令 ..............................................................................................613
21.2.5 测试脚本支持 ..............................................................................................617
21.3 在Cocoa 程序中写脚本 .......................................................................................620
21.4 把服务显露给Automator .....................................................................................626
21.5 其他的脚本技术 ...................................................................................................626
21.5.1 分布式对象 ..................................................................................................627
21.5.2 F-Script .........................................................................................................627
21.6 小结 .......................................................................................................................628
第七部分 系统编程
第22 章 联网 ...............................................................................................630
22.1 底层套接字编程 ...................................................................................................630
22.2 Cocoa 流 ................................................................................................................636
22.3 URL 的处理 ..........................................................................................................637
22.3.1 创建URL .....................................................................................................638
22.3.2 从URL 装入 ................................................................................................638
22.3.3 扩展URL 装载系统 ....................................................................................641
22.4 Bonjour ..................................................................................................................644
22.4.1 多播DNS .....................................................................................................644
22.4.2 DNS 服务发现 .............................................................................................645
22.4.3 浏览服务 ......................................................................................................645
22.4.4 通告服务 ......................................................................................................648
22.5 分布式对象 ...........................................................................................................649
22.5.1 对象的发布 ..................................................................................................650
22.5.2 获取远程对象 ..............................................................................................652
22.5.3 一个简单的聊天程序 ..................................................................................653
22.6 总结 .......................................................................................................................660
第23 章 并发 ...............................................................................................661
23.1 分布式对象 ...........................................................................................................662
23.2 线程 .......................................................................................................................664
23.2.1 创建线程 ......................................................................................................664
23.2.2 线程局部存储 ..............................................................................................665
23.2.3 同步 ..............................................................................................................665
23.2.4 原子操作 ......................................................................................................673
23.2.5 未来与转发 ..................................................................................................676
23.2.6 线程压力测试 ..............................................................................................678
23.3 子进程 ...................................................................................................................679
23.3.1 创建子进程 ..................................................................................................679
23.3.2 跟子进程通信 ..............................................................................................680
23.3.3 共享内存 ......................................................................................................681
23.4 操作队列 ...............................................................................................................685
23.5 大调度中心 ...........................................................................................................690
23.6 OpenCL .................................................................................................................692
23.7 小结 .......................................................................................................................693
第八部分 附录
第24 章 可移植的Cocoa .............................................................................696
24.1 NeXT 和Sun .........................................................................................................696
24.2 iPhone 上的移动OS X .........................................................................................697
24.3 OpenStep 和GNU .................................................................................................697
24.4 GNUstep ................................................................................................................698
24.4.1 GORM ..........................................................................................................700
24.4.2 使用GNUstep 进行构建 .............................................................................701
24.4.3 Étoilé ............................................................................................................703
24.5 QuantumSTEP .......................................................................................................703
24.6 Cocotron .................................................................................................................704
24.7 GNUstepWeb 与SOPE .........................................................................................705
第25 章 高级技巧 ........................................................................................706
25.1 预处理器 ...............................................................................................................707
25.1.1 初始化程序 ..................................................................................................707
25.1.2 For Each .......................................................................................................707
25.1.3 Objective-C 常量 .........................................................................................709
25.1.4 简单模板 ......................................................................................................710
25.1.5 友好的调试输出 ..........................................................................................711
25.2 控制结构 ...............................................................................................................711
25.2.1 NSDictionary 滥用 ......................................................................................712
25.2.2 键—值编码 ..................................................................................................713
25.2.3 Trampoline ...................................................................................................714
25.2.4 状态机 ..........................................................................................................717
25.3 整洁代码 ...............................................................................................................719
25.3.1 Toll-Free 桥接 ..............................................................................................719
25.3.2 多重继承 ......................................................................................................720
25.4 优化 .......................................................................................................................722
25.4.1 实例方法指针 ..............................................................................................723
25.4.2 推翻动态调度 ..............................................................................................724
25.4.3 栈中的类 ......................................................................................................726
25.4.4 对象池 ..........................................................................................................730
25.4.5 内联函数 ......................................................................................................731
25.4.6 避免对象 ......................................................................................................733
25.5 Cocoa 跨平台 ........................................................................................................734
25.6 运行系统 ...............................................................................................................737
25.6.1 理解对象实现 ..............................................................................................738
25.6.2 枚举所有子类 ..............................................................................................740
25.6.3 给一个类增加方法 ......................................................................................743
· · · · · · ()

"Cocoa编程开发者手册"试读 · · · · · ·

· · · · · · ()


下载地址

发布者:你是会闪光的星

文件说明:zip / 解压密码:electro-lviv.com

迅雷下载:您需要先后,才能查看

网盘下载:您需要先后,才能查看

关于内容:内容自于互联网,如果发现有违规内容请联系管理员删除!

作者: 你是会闪光的星

你是会闪光的星

该用户很懒,还没有介绍自己。

13 条评论

发表评论

  1. 陈很怪陈很怪说道:
    1#

    大爱,好好看

  2. 白白客星白白客星说道:
    2#

    没想到刚开始就牢牢抓住了我的眼球。

  3. 牟瞳牟瞳说道:
    3#

    打通了界限

  4. 豪华七对自摸豪华七对自摸说道:
    4#

    从演化的角度入手

  5. 显示更多