-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
385 lines (213 loc) · 12 KB
/
index.html
File metadata and controls
385 lines (213 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>iOSBuilding Blog</title>
<meta name="author" content="iOSBuilding">
<meta name="description" content="当两个对象A对象B,比如两个ViewController他们需要传递数据,你能想到那些方法呢? NSNotificationCenter 一对多的传递方式。对象A发出一个消息到消息中心,消息中心随后分发消息给监听该消息的对象,对象与对象之间不需要彼此知道,有点太loose啦。 KVO (Key- …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://iOSBuilding.github.com">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="iOSBuilding Blog" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">iOSBuilding Blog</a></h1>
<h2>我们分享,我们快乐。</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:iOSBuilding.github.com" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">博客分享</a></li>
<li><a href="/blog/archives">博客归档</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/03/21/zai-oczhong-liang-ge-dui-xiang-de-jiao-hu/">在OC中两个对象的交互</a></h1>
<p class="meta">
<time datetime="2013-03-21T08:51:00+08:00" pubdate data-updated="true">Mar 21<span>st</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>当两个对象A对象B,比如两个ViewController他们需要传递数据,你能想到那些方法呢?</p>
<h3>NSNotificationCenter</h3>
<p>一对多的传递方式。对象A发出一个消息到消息中心,消息中心随后分发消息给监听该消息的对象,对象与对象之间不需要彼此知道,有点太loose啦。</p>
<h3>KVO (Key-Value Observing)</h3>
<p>对象A监听对象B的属性,当对象B被监听的属性改变,通知对象A执行想要执行的方法。</p>
<h3>Direct pointers</h3>
<p>对象A有一个指针指向对象B,从而直接使用该指针操作对象B。</p>
<h3>Delegate</h3>
<p>对象A是对象B的代理。在这种情况下对象A不知道任何关于对象B的事,他只知道对象作为他的代理可以传递消息。</p>
<h3>Blocks</h3>
<p>Blocks和代理有些类似。对象B给对象A一个或多个blocks只有当特定消息的发生的时候才执行。可以看AFNetworking里面大量使用block。</p>
<p>此文大部分翻译自<a href="https://github.com/hollance">@hollance</a>的<a href="http://www.hollance.com/2012/07/communicate-between-objects-using-channels/">Communicate between objects using channels</a>
主要是为自己总结,不足之处,敬请谅解。</p>
<p>另奉上一大神关于NSNotificationCenter的Blog<a href="http://www.mikeash.com/pyblog/friday-qa-2011-07-08-lets-build-nsnotificationcenter.html">Let’s Build NSNotificationCenter</a>。</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/03/20/afnetworkingde-zong-jie/">AFNetworking的总结</a></h1>
<p class="meta">
<time datetime="2013-03-20T16:02:00+08:00" pubdate data-updated="true">Mar 20<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>一直想写一篇关于AFNetworking学习总结的文章便于自己记忆,迟迟没有动手,今天终于开始动笔啦。自从ASIH的作者停止更新之后,我们不免有点小失望,直到AFNetworking的出现让我们重新燃起激情。AFnetworking稳定的更新维护及其良好的可扩展性,不得不佩服<a href="https://github.com/mattt">@matt</a>确实是个geek.<br/>
<strong>AFnetwokring的OverView</strong>
<img src="https://github.com/AFNetworking/AFNetworking/raw/gh-pages/afnetworking-architecture-diagram.png" alt="" /></p>
<p>AFnetworking的构成</p>
<ul>
<li><code>AFURLConnectionOperation</code> NSOperation的子类主要实现NSURLConnection协议的方法</li>
<li><code>AFHTTPRequsetOperation</code> AFURLConnectionOpration的子类封装一些http相关的协议</li>
<li><code>AFJSONRequsetOperation</code> AFHTTPRequsetOperation的子类,用于JSON的解析(默认使用的是系统自带JSON解析NSJSONSerialization)</li>
<li><code>AFXMLRequsetOperation</code> AFHTTPRequsetOperation的子类,用于XML的解析</li>
<li><code>AFPropertyListRequestOperation</code> AFHTTPRequsetOperation的子类,用于Plist文件的解析</li>
<li><code>AFImageRequestOperation</code> AFHTTPRequsetOperation的子类,用于图片的下载</li>
<li><code>UIImageView+AFnetworking</code> UIImageView的扩展,异步加载图片</li>
<li><code>AFHTTPClient</code> NSObeject的子类,实现基于base URL的网络请求</li>
</ul>
<p><strong>注意以上所有的网络请求都是异步</strong></p>
<h2>AFNetworking类的使用</h2>
<h3>AFHTTPRequsetOperation的使用</h3>
<pre><code>AFHTTPRequsetOperation *requsetOpeation = [[AFHTTPRequsetOperation alloc]initWithRequest:urlRequest];
[requsetOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
self.data = responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error){
NSLog(@"%@", [error localizedDescription]);
}];
[requsetOpeation start];
</code></pre>
<h3>AFJSONRequsetOtion的使用</h3>
<pre><code>AFJSONRequestOperation *requsetOpeation = [AFJSONRequestOperation JSONRequestOperationWithRequest:urlResquest
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
if ([JSON isKindOfClass:[NSData class]]) {
self.data = JSON;
} else if([JSON isKindOfClass:[NSDictionary class]]){
self.dictionary = JSON;
}
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"%@", [error localizedDescription]);
}];
[requsetOpeation start];
</code></pre>
<h3>AFXMLRequsetOperation的使用</h3>
<pre><code>AFXMLRequestOperation *requsetOpeation = [AFXMLRequestOperation XMLParserRequestOperationWithRequest:urlResquest
success:^(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser) {
XMLParser.delegate = self;
[XMLParser parse];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLParser *XMLParser) {
NSLog(@"%@", [error localizedDescription]);
}];
[requsetOpeation start];
</code></pre>
<h3>AFPropertyListRequestOperation的使用</h3>
<pre><code>AFPropertyListRequestOperation *requsetOpeation = [AFPropertyListRequestOperation propertyListRequestOperationWithRequest:urlResquest
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList) {
self.dictionary = propertyList;
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList) {
NSLog(@"%@", [error localizedDescription]);
}];
[requsetOpeation start];
</code></pre>
<h3>AFImageRequestOperation的使用</h3>
<h3>UIImageView+AFnetworking的使用</h3>
<h3>AFHTTPClien的使用</h3>
<h2><strong><em>AFnetworking extension</em></strong></h2>
<p>待续。。。。。。</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/03/20/guan-yu-ioschang-yong-de-ji-ge-kai-fa-gong-ju/">关于ios常用的几个开发工具</a></h1>
<p class="meta">
<time datetime="2013-03-20T14:00:00+08:00" pubdate data-updated="true">Mar 20<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>今天是我们群建立博客的第一天,下面分享几个iOS开发使用的几个工具:</p>
<h2>KSImageNamed-Xcode</h2>
<p>当我们在XCode开发中使用[UImage imageNamed:]输入图片的名字很烦,而这个工具可以方便的帮我们自动完成图片文字的输入,我们只需要上下键选择所需要的名字即可</p>
<p><img src="/images/blog1-kimage-screenshot.png"></p>
<p><a href="https://github.com/ksuther/KSImageNamed-Xcode">下载地址</a></p>
<p><em>安装方法</em>打开下载的工程运行一下就自动安装啦</p>
<h2>查看Sqite中存入数据工具</h2>
<p>当我们要查看sqilte里的数据的时候怎么办,总不能每次都手动代码查看把,下面介绍几个工具</p>
<ul>
<li>SQLite Database Browser <a href="http://sourceforge.net/projects/sqlitebrowser/">下载地址</a></li>
<li>还有火狐下的一款插件工具SQLite Manager</li>
</ul>
<h2>BBUncrustifyPlugin-Xcode(代码美化工具)</h2>
<p>这是一个代码美化工具的Xcode的插件,当我们代码写成如下形式时
<img src="/images/code1.png"></p>
<p>只要运行下这个插件(点击Edit=>Uncrustify选项)就美化成如下形式
<img src="/images/code2.png"></p>
<p><a href="https://github.com/benoitsan/BBUncrustifyPlugin-Xcode">下载地址</a></p>
<p><em>安装方法</em>打开下载的工程运行一下就自动安装啦</p>
<h2>Xcode中完美的插件管理工具</h2>
<p>在也不要去愁去寻找Xcode的插件了!!!</p>
<p><a href="https://github.com/mneorr/alcatraz-packages">下载地址</a></p>
<h2>SimPholders</h2>
<p>快速方便查找Xocde的项目在Finder位置,不要在杯具的望着一堆hash一直一个一个寻找自己刚编译完的项目了</p>
<p><a href="http://simpholders.com/">下载地址</a></p>
<h2>后续更新中 哈哈</h2>
</div>
</article>
<div class="pagination">
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2013/03/21/zai-oczhong-liang-ge-dui-xiang-de-jiao-hu/">在OC中两个对象的交互</a>
</li>
<li class="post">
<a href="/blog/2013/03/20/afnetworkingde-zong-jie/">AFNetworking的总结</a>
</li>
<li class="post">
<a href="/blog/2013/03/20/guan-yu-ioschang-yong-de-ji-ge-kai-fa-gong-ju/">关于ios常用的几个开发工具</a>
</li>
</ul>
</section>
<section>
<h1>关于我们</h1>
<p>
<br/>我们是一群热爱编程的人,欢迎加入我们。
<br/>QQ群:132060905
</p>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2013 - iOSBuilding -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
</body>
</html>