没有合适的资源?快使用搜索试试~ 我知道了~
The NSHipster Fake Book
5星 · 超过95%的资源 需积分: 10 43 下载量 76 浏览量
2017-06-07
09:10:36
上传
评论 3
收藏 1.12MB PDF 举报
温馨提示
试读
108页
Object C 进阶的书籍,要有一定的基础,阅读起来才知道本书的深度,不建议初学者下载。
资源推荐
资源详情
资源评论
OBJECTIVE-C
The
NSHipster
Fake
Bk
The NSHipster Fake Book
Mattt Thompso n
Contents
1 Standards 1
1.1 Creating a Nonretained Object Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Adding an Anonymous Observer to a Notification Center . . . . . . . . . . . . . . . . . . . . . 1
1.3 Accessing Thread-Unsafe Objects from a Thread Dictionary . . . . . . . . . . . . . . . . . . . 1
1.4 Converting a String to a Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Converting a Number to a String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6 Implementing Indexed Subscripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.7 Implementing Keyed Subscripti ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.8 Using a Method that accepts an Error Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.9 Implementing a Method that takes an E rror Parameter . . . . . . . . . . . . . . . . . . . . . . . 3
1.10 Logging Class, Method, and Line Number Context . . . . . . . . . . . . . . . . . . . . . . . . 3
1.11 Key-Value Archiving & Unarchiving an Object . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.12 Archiving / Unarchiving an O bject into NSUserDefaults . . . . . . . . . . . . . . . . . . . . . 4
1.13 Creating a KeyPath from Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.14 Adding an Item to the Keychain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.15 Evaluating a Mathematical Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.16 Decoding JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.17 Encoding JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.18 Getting the Name of the Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Language & Runtime 7
2.1 Declaring an NS_ENUM Ty pe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Declaring an NS_OPTIONS Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Creating String Representations for Enumerated Type . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Adding a Property to a Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Swizzling a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Determining the Typ e of a Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.7 Determining the Typ e of a CFTypeRef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.8 Specifying the Availability of a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9 Hiding a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
ii
2.10 Hiding a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.11 Ignoring Compiler Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.12 Determining the Current System Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.13 Getting the Current OS Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2
2.14 Declaring a Constant Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.15 Determining Whether an Object is Null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.16 Declaring an Argument or Parameter as Unused . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.17 Creating Variadic Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.18 Creating a Variadic Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.19 Overloading Functi ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.20 Determining if ARC is Available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.21 Conditionally Compiling for iOS & OS X Targets . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.22 Determining if Class is Available for Target Platform at Runtime . . . . . . . . . . . . . . . . . 16
2.23 Determining if Method is Available for Target Platform at Runtime . . . . . . . . . . . . . . . . 16
2.24 Determining if Function is Available for Target Platform at Runtime . . . . . . . . . . . . . . . 17
2.25 Adding a Class at Runtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.26 Adding a Method to a Class at Runtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.27 Getting the Subclasses and Superclasses of a Class . . . . . . . . . . . . . . . . . . . . . . . . 19
2.28 Requiring Method to call super . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.29 Determining the Caller of a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.30 Creating Variadic Formatting Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.31 Intentionally Crashing the Current Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3 Grand Central Dispatch 22
3.1 Dispatching Work Asynchronously to a Background Queue . . . . . . . . . . . . . . . . . . . . 22
3.2 Benchmarking the Execution Time of an operation . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Monitoring Local File Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4 Creating a Singleton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5 Monitoring the Parent Process PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6 Reading from STDIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.7 Monitoring Local File Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.8 Dispatching a Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4 Cryptography 28
4.1 Encrypting & Decrypting Using AES-128 With PBKDF2 Key . . . . . . . . . . . . . . . . . . 28
4.2 Base64-Decoding Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Base64-Encoding Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4 Calculating MD5 Digest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5 Calculating SHA-1 Digest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
iii
4.6 Generating SHA-1 HMAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5 Random 34
5.1 Creating a Random Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2 Creating a Random Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.3 Creating a Random String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.4 Creating a Random Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.5 Generating Random Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.6 Creating a UUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.7 Creating a GUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6 Collections 37
6.1 Enumerating an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.2 Enumerating a Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3 Creating a Mutable Copy of an A rray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.4 Creating a Mutable Copy of a Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.5 Creating a Case-Insensitive Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.6 Accessing Mutable Dictionary in a Thread-Safe Manner . . . . . . . . . . . . . . . . . . . . . 39
6.7 Reversing an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.8 Shuffling an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.9 Creating a String from an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.10 Filtering Objects in Array by Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.11 Computing the Sum of an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.12 Removing Duplicate Objects from an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7 Linguistics & Typography 41
7.1 Creating a Font from TTF / OTF Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.2 Determining the Current Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.3 Looking Up the Definition of a Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.4 Applying Foreground Color to an Attributed String . . . . . . . . . . . . . . . . . . . . . . . . 42
7.5 Creating an Attributed String from HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.6 Getting Characters from a Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.7 Detecting Phone Number and Address from a String . . . . . . . . . . . . . . . . . . . . . . . 44
7.8 Comparing Version Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.9 Finding Proper Nouns in a String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.10 Calculating String Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.11 Formatting Strin gs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
7.12 Determining the Language of a String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
7.13 Concatenating String Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
iv
剩余107页未读,继续阅读
资源评论
- xyh_Adolph2017-07-10好多高质量书籍
- qinken5472017-06-13厉害了,好多高质量书籍
- leeming05032017-11-12很好的资源,谢谢分享
xrick
- 粉丝: 51
- 资源: 47
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功