-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
512 lines (336 loc) · 34.9 KB
/
index.html
File metadata and controls
512 lines (336 loc) · 34.9 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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<title>偏痴</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="自由就是说不的权利">
<meta property="og:type" content="website">
<meta property="og:title" content="偏痴">
<meta property="og:url" content="http://gcfrun.github.io/index.html">
<meta property="og:site_name" content="偏痴">
<meta property="og:description" content="自由就是说不的权利">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="偏痴">
<meta name="twitter:description" content="自由就是说不的权利">
<link rel="alternative" href="/atom.xml" title="偏痴" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div class="left-col">
<div class="overlay"></div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="/" class="profilepic">
<img lazy-src="null" class="js-avatar">
</a>
<hgroup>
<h1 class="header-author"><a href="/">chaofan.gong</a></h1>
</hgroup>
<p class="header-subtitle">自由就是说不的权利</p>
<div class="switch-btn">
<div class="icon">
<div class="icon-ctn">
<div class="icon-wrap icon-house" data-idx="0">
<div class="birdhouse"></div>
<div class="birdhouse_holes"></div>
</div>
<div class="icon-wrap icon-ribbon hide" data-idx="1">
<div class="ribbon"></div>
</div>
<div class="icon-wrap icon-link hide" data-idx="2">
<div class="loopback_l"></div>
<div class="loopback_r"></div>
</div>
<div class="icon-wrap icon-me hide" data-idx="3">
<div class="user"></div>
<div class="shoulder"></div>
</div>
</div>
</div>
<div class="tips-box hide">
<div class="tips-arrow"></div>
<ul class="tips-inner">
<li>Menu</li>
<li>Tags</li>
<li>Links</li>
<li>About</li>
</ul>
</div>
</div>
<div class="switch-area">
<div class="switch-wrap">
<section class="switch-part switch-part1">
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="#" title="github">github</a>
<a class="weibo" target="_blank" href="#" title="weibo">weibo</a>
<a class="rss" target="_blank" href="#" title="rss">rss</a>
<a class="zhihu" target="_blank" href="#" title="zhihu">zhihu</a>
</div>
</nav>
</section>
<section class="switch-part switch-part2">
<div class="widget tagcloud" id="js-tagcloud">
</div>
</section>
<section class="switch-part switch-part3">
<div id="js-friends">
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">奥巴马的博客</a>
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">卡卡的美丽传说</a>
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">本泽马的博客</a>
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">吉格斯的博客</a>
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">习大大大不同</a>
<a target="_blank" class="main-nav-link switch-friends-link" href="http://localhost:4000/">托蒂的博客</a>
</div>
</section>
<section class="switch-part switch-part4">
<div id="js-aboutme">我是谁,我从哪里来,我到哪里去?我就是我,是颜色不一样的吃货…</div>
</section>
</div>
</div>
</header>
</div>
</div>
<div class="mid-col">
<nav id="mobile-nav">
<div class="overlay">
<div class="slider-trigger"></div>
<h1 class="header-author js-mobile-header hide">chaofan.gong</h1>
</div>
<div class="intrude-less">
<header id="header" class="inner">
<div class="profilepic">
<img lazy-src="null" class="js-avatar">
</div>
<hgroup>
<h1 class="header-author">chaofan.gong</h1>
</hgroup>
<p class="header-subtitle">自由就是说不的权利</p>
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
<div class="clearfix"></div>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="#" title="github">github</a>
<a class="weibo" target="_blank" href="#" title="weibo">weibo</a>
<a class="rss" target="_blank" href="#" title="rss">rss</a>
<a class="zhihu" target="_blank" href="#" title="zhihu">zhihu</a>
</div>
</nav>
</header>
</div>
</nav>
<div class="body-wrap">
<article id="post-mac下创建hexo博客" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/09/mac下创建hexo博客/" class="article-date">
<time datetime="2016-03-09T10:28:25.000Z" itemprop="datePublished">2016-03-09</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/09/mac下创建hexo博客/">Hexo-mac 下搭建hexo博客全过程</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>mac下搭建hexo博客,步骤多,加上网上教程不是特别详细,尤其对于新手来说,特别容易出错,出错了都不知道怎么搜寻解决办法,本人把mac下搭建hexo的详细步骤,包括常见错误也都写出来。</p>
<h3 id="先屡下思路"><a href="#先屡下思路" class="headerlink" title="先屡下思路"></a>先屡下思路</h3><ol>
<li>首先hexo是基于nodejs的,所以必须安装nodejs</li>
<li>安装nodejs方法很多,我选择homebrew安装方式,所以需要安装它</li>
<li>安装homebrew就很简单了,mac自带ruby脚本功能,一句话搞定</li>
<li>hexo提交部署github需要使用git工具,所以需要安装git,用homebrew的话也是一句话搞定</li>
<li>安装顺序(homebrew-nodejs-hexo-git)</li>
</ol>
<h4 id="安装brewhome"><a href="#安装brewhome" class="headerlink" title="安装brewhome"></a>安装brewhome</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ruby <span class="_">-e</span> <span class="string">"<span class="variable">$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)</span>”</span></span><br></pre></td></tr></table></figure>
<p>打开<a href="http://brew.sh/" target="_blank" rel="external">brew网址</a>获取最新brew安装方法,brew安装之后默认主目录在/usr/local/bin/brew下</p>
<h4 id="安装nodejs"><a href="#安装nodejs" class="headerlink" title="安装nodejs"></a>安装nodejs</h4><figure class="highlight crmsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">brew install <span class="keyword">node</span><span class="title"></span></span><br></pre></td></tr></table></figure>
<h4 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h4><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">npm <span class="keyword">install</span> -g hexo</span><br><span class="line">hexo init</span><br><span class="line">npm <span class="keyword">install</span></span><br></pre></td></tr></table></figure>
<p>hexo安装后默认主目录为/Users/xxx,xxx为你的计算机用户名,_config.yml,themes,source,scaffolds一些很常用文件都在这个目录下</p>
<h4 id="安装git"><a href="#安装git" class="headerlink" title="安装git"></a>安装git</h4><figure class="highlight mipsasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="keyword">brew </span><span class="keyword">install </span>git</span><br></pre></td></tr></table></figure>
<p>安装git时可能会提醒一次,安装会失败,继续安装</p>
<h4 id="配置SSH-key"><a href="#配置SSH-key" class="headerlink" title="配置SSH key"></a>配置SSH key</h4><p>用github管理项目的时候,可以直接使用https url克隆到本地,也可以使用SSH url克隆到本地,使用SSH rul克隆的话需要先配置添加好SSH key。</p>
<ol>
<li>检查SSH key</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/.ssh</span><br></pre></td></tr></table></figure>
<p>这个命令就是检查是否已经存在 id_rsa.pub 或id_dsa.pub文件,如果已经存在,可以跳过步骤2,直接进入步骤3.</p>
<ol>
<li>生成SSH key </li>
</ol>
<figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">$ </span>ssh-keygen -t rsa -C <span class="string">"your_email@example.com"</span></span><br></pre></td></tr></table></figure>
<p>运行上面那条命令后会让你输入一个文件名,用于保存刚才生成的SSH key代码,如:</p>
<figure class="highlight delphi"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Generating <span class="keyword">public</span>/<span class="keyword">private</span> rsa key pair.</span><br><span class="line"># Enter <span class="keyword">file</span> <span class="keyword">in</span> which <span class="keyword">to</span> save the key (/c/Users/you/.ssh/id_rsa): [Press enter]</span><br></pre></td></tr></table></figure>
<p>接着又会提示输入两次密码,改密码是push文件的时候需要输入的密码,而不是github管理者的密码,当然可以不输入密码,直接回车,那么push的时候就不需要输入密码,直接提交到github上了,如:</p>
<figure class="highlight coffeescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Enter passphrase (empty <span class="keyword">for</span> <span class="literal">no</span> passphrase): </span><br><span class="line"><span class="comment"># Enter same passphrase again:</span></span><br></pre></td></tr></table></figure>
<p>接下来,就会显示如下代码提示,如:</p>
<figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">Your</span> identification has <span class="keyword">been </span>saved in /c/Users/you/.ssh/id_rsa.</span><br><span class="line"># Your public key has <span class="keyword">been </span>saved in /c/Users/you/.ssh/id_rsa.pub.</span><br><span class="line"># The key fingerprint is:</span><br><span class="line"># <span class="number">01</span>:<span class="number">0</span>f:<span class="built_in">f4</span>:<span class="number">3</span>b:ca:<span class="number">85</span>:<span class="built_in">d6</span>:<span class="number">17</span>:<span class="built_in">a1</span>:<span class="number">7</span>d:<span class="built_in">f0</span>:<span class="number">68</span>:<span class="number">9</span>d:<span class="built_in">f0</span>:<span class="built_in">a2</span>:db your_email<span class="comment">@example.com</span></span><br></pre></td></tr></table></figure>
<p>看到这段代码提示时,说明你的SSH key已经创建成功,只需要添加到github的SSHkey上就可以了。</p>
<ol>
<li><p>将SSH key添加到Github</p>
<p> 先拷贝id_rsa.pub文件的内容,可以用编辑器打开文件复制,目录/Users/xxx/.ssh/id_rsa,xxx为你计算机用户名。</p>
<p> 然后登陆github账号,从右上角的设置(Settings)进入,然后点击菜单栏的SSH key进入页面添加SSH key。</p>
<p> 最后点击 Add SSH key 按钮添加一个 SSH key 。把你复制的 SSH key 代码粘贴到 key 所对应的输入框中,记得 SSH key 代码的前后不要留有空格或者回车。当然,上面的 Title 所对应的输入框你也可以输入一个该 SSH key 显示在 github 上的一个别名。默认的会使用你的邮件名称。</p>
</li>
<li>测试连接</li>
</ol>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">ssh</span> -T git<span class="variable">@github</span>.com</span><br></pre></td></tr></table></figure>
<p>当输入以上代码时,会有一段警告代码,如:</p>
<figure class="highlight applescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">The authenticity <span class="keyword">of</span> host 'github.com (<span class="number">207.97</span><span class="number">.227</span><span class="number">.239</span>)' can't be established.</span><br><span class="line"><span class="comment"># RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.</span></span><br><span class="line"><span class="comment"># Are you sure you want to continue connecting (yes/no)?</span></span><br></pre></td></tr></table></figure>
<p>这是正常的,输入yes回车即可。如果你创建 SSH key 的时候设置了密码,接下来就会提示你输入密码,如:</p>
<figure class="highlight processing"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Enter passphrase <span class="keyword">for</span> <span class="built_in">key</span> <span class="string">'/c/Users/Administrator/.ssh/id_rsa'</span>:</span><br></pre></td></tr></table></figure>
<p>如果用户名是正确的,你已经成功设置SSH密钥。如果你看到 “access denied” ,表示拒绝访问,那么你就需要使用 https 去访问,而不是 SSH 。</p>
<h4 id="配置个人信息"><a href="#配置个人信息" class="headerlink" title="配置个人信息"></a>配置个人信息</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">git</span> <span class="selector-tag">config</span> <span class="selector-tag">--global</span> <span class="selector-tag">user</span><span class="selector-class">.name</span> "<span class="selector-tag">gcfrun</span>”</span><br><span class="line"><span class="selector-tag">git</span> <span class="selector-tag">config</span> <span class="selector-tag">--global</span> <span class="selector-tag">user</span><span class="selector-class">.email</span> <span class="selector-tag">chaofan</span><span class="selector-class">.gong</span>@<span class="keyword">gmail.com</span></span><br></pre></td></tr></table></figure>
<h4 id="修改-congfig-yml文件"><a href="#修改-congfig-yml文件" class="headerlink" title="修改_congfig.yml文件"></a>修改_congfig.yml文件</h4><figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">deploy</span>:</span><br><span class="line"> <span class="attribute">type</span>: git</span><br><span class="line"> <span class="attribute">repo</span>: git<span class="variable">@github</span>.<span class="attribute">com</span>:xxxx/xxxx.github.io.git</span><br><span class="line"> <span class="attribute">branch</span>: master</span><br></pre></td></tr></table></figure>
<p>xxx为你的github账号名称</p>
<h4 id="注册githhub,新建xxxx-github-io的repository"><a href="#注册githhub,新建xxxx-github-io的repository" class="headerlink" title="注册githhub,新建xxxx.github.io的repository"></a>注册githhub,新建xxxx.github.io的repository</h4><p><a href="github.com">github网址</a></p>
<h4 id="克隆主题"><a href="#克隆主题" class="headerlink" title="克隆主题"></a>克隆主题</h4><p>进入hexo官网,预览自己想要的主题</p>
<p><a href="https://github.com/hexojs/hexo/wiki/Themes" target="_blank" rel="external">https://github.com/hexojs/hexo/wiki/Themes</a><br>这里拿yilia为例:</p>
<figure class="highlight crmsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="keyword">clone</span> <span class="title">https</span>://github.com/litten/hexo-theme-yilia.git themes/yilia</span><br></pre></td></tr></table></figure>
<p>修改hexo根目录下的 _config.yml : theme: yilia<br>更新</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> themes/yilia</span><br><span class="line">git pull</span><br></pre></td></tr></table></figure>
<h4 id="上传主题到github"><a href="#上传主题到github" class="headerlink" title="上传主题到github"></a>上传主题到github</h4><p>hexo server ,访问 localhost:4000 预览效果。(退出server用Ctrl+c)</p>
<p>hexo deploy ,同步到github。访问网站看看效果。<br>注:hexo 3.0以上版本得加上</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm <span class="keyword">install</span> hexo-deployer-git <span class="comment">--save</span></span><br></pre></td></tr></table></figure>
<p>到此的话,mac下hexo博客搭建,主题上传都已完成,只差写博客了。</p>
</div>
<div class="article-info article-info-index">
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-Baner页循环轮播" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/09/Baner页循环轮播/" class="article-date">
<time datetime="2016-03-09T10:28:25.000Z" itemprop="datePublished">2016-03-09</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/09/Baner页循环轮播/">ScrollView+UIImageView 无限循环轮播</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>项目开发中经常遇到首页要用到Banner页轮播图片,基于性能和用户体验性考虑,使用ScrollView+UIImageView来实现,设计思想:用三个UIImageView来显示图片,中间的centerImageView显示当前索引下的图片,leftImageView显示前一张图片,rightImageView显示后一张图片。每当scrollView滑动停止时,重新设置三张ImageView的图片,并让scrollView显示中间额centerImageView。</p>
<h3 id="公有方法"><a href="#公有方法" class="headerlink" title="公有方法"></a>公有方法</h3><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*初始化*/</span></span><br><span class="line">-(<span class="keyword">id</span>)initWithFrame:(<span class="built_in">CGRect</span>)frame withUrlArr:(<span class="built_in">NSArray</span> *)urlArr withTapBlock:(<span class="keyword">void</span>(^)(<span class="built_in">NSInteger</span> selectIndex)) block;</span><br><span class="line">-(<span class="keyword">id</span>)initWithFrame:(<span class="built_in">CGRect</span>)frame withImgArr:(<span class="built_in">NSArray</span> *)imgArr withTapBlock:(<span class="keyword">void</span>(^)(<span class="built_in">NSInteger</span> selectIndex)) block;</span><br><span class="line"><span class="comment">/*动画*/</span></span><br><span class="line">-(<span class="keyword">void</span>)startAnimationWithInterval:(<span class="built_in">NSInteger</span>)interval;</span><br><span class="line">-(<span class="keyword">void</span>)stopAnimation;</span><br></pre></td></tr></table></figure>
<h3 id="私有属性"><a href="#私有属性" class="headerlink" title="私有属性"></a>私有属性</h3><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">{</span><br><span class="line"> <span class="built_in">BOOL</span> _isUrl;</span><br><span class="line">}</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">copy</span>)<span class="keyword">void</span> (^tapBlock)(<span class="built_in">NSInteger</span> selectIndex);</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">UIScrollView</span> *scrollView;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">UIPageControl</span> *pageControl;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">NSTimer</span> *timer;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>)<span class="built_in">NSInteger</span> currentImageIndex;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">UIImageView</span> *leftImageView;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">UIImageView</span> *centerImageView;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">strong</span>)<span class="built_in">UIImageView</span> *rightImageView;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">copy</span>)<span class="built_in">NSArray</span> *imgArr;</span><br><span class="line"><span class="keyword">@property</span>(<span class="keyword">nonatomic</span>,<span class="keyword">copy</span>)<span class="built_in">NSArray</span> *urlArr;</span><br></pre></td></tr></table></figure>
<h3 id="核心代码"><a href="#核心代码" class="headerlink" title="核心代码"></a>核心代码</h3><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">-(<span class="keyword">void</span>)reloadImage</span><br><span class="line">{</span><br><span class="line"> <span class="built_in">NSInteger</span> leftImageIndex,rightImageIndex;</span><br><span class="line"> <span class="built_in">CGPoint</span> offset=[_scrollView contentOffset];</span><br><span class="line"> <span class="keyword">if</span> (offset.x><span class="built_in">CGRectGetWidth</span>(<span class="keyword">self</span>.frame)) { <span class="comment">//向右滑动</span></span><br><span class="line"> _currentImageIndex=(_currentImageIndex+<span class="number">1</span>)%<span class="keyword">self</span>.pageControl.numberOfPages;</span><br><span class="line"> }<span class="keyword">else</span> <span class="keyword">if</span>(offset.x<<span class="built_in">CGRectGetWidth</span>(<span class="keyword">self</span>.frame)){ <span class="comment">//向左滑动</span></span><br><span class="line"> _currentImageIndex=(_currentImageIndex+<span class="keyword">self</span>.pageControl.numberOfPages<span class="number">-1</span>)%<span class="keyword">self</span>.pageControl.numberOfPages;</span><br><span class="line"> }</span><br><span class="line"> leftImageIndex=(_currentImageIndex+<span class="keyword">self</span>.pageControl.numberOfPages<span class="number">-1</span>)%<span class="keyword">self</span>.pageControl.numberOfPages;</span><br><span class="line"> rightImageIndex=(_currentImageIndex+<span class="number">1</span>)%<span class="keyword">self</span>.pageControl.numberOfPages;</span><br><span class="line"> <span class="keyword">if</span>(_isUrl)</span><br><span class="line"> {</span><br><span class="line"> [_centerImageView sd_setImageWithURL:[<span class="built_in">NSURL</span> URLWithString:_urlArr[_currentImageIndex]]];</span><br><span class="line"> [_leftImageView sd_setImageWithURL:[<span class="built_in">NSURL</span> URLWithString:_urlArr[leftImageIndex]]];</span><br><span class="line"> [_rightImageView sd_setImageWithURL:[<span class="built_in">NSURL</span> URLWithString:_urlArr[rightImageIndex]]];</span><br><span class="line"> }<span class="keyword">else</span></span><br><span class="line"> {</span><br><span class="line"> _centerImageView.image=_imgArr[_currentImageIndex];</span><br><span class="line"> _leftImageView.image=_imgArr[leftImageIndex];</span><br><span class="line"> _rightImageView.image=_imgArr[rightImageIndex];</span><br><span class="line"> }</span><br><span class="line"> _pageControl.currentPage=_currentImageIndex;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="demo下载地址,这个demo可以拿来直接用"><a href="#demo下载地址,这个demo可以拿来直接用" class="headerlink" title="demo下载地址,这个demo可以拿来直接用"></a>demo<a href="https://github.com/gcfrun/CFCycleBannerView" target="_blank" rel="external">下载地址</a>,这个demo可以拿来直接用</h3>
</div>
<div class="article-info article-info-index">
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post- Github-mac 上传项目" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/09/ Github-mac 上传项目/" class="article-date">
<time datetime="2016-03-09T10:28:23.000Z" itemprop="datePublished">2016-03-09</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/09/ Github-mac 上传项目/">Github-mac 上传项目</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>这篇文章对于刚刚开始接触github,甚至连markdown、git、hexo都不了解的人来使应该有很大的帮助,博主自己就是这样的人,你也能成功。</p>
<h3 id="建立仓库"><a href="#建立仓库" class="headerlink" title="建立仓库"></a>建立仓库</h3><p>在githhub新建一个repository(可以百度或者谷歌),这是官方help<a href="https://help.github.com/articles/create-a-repo" target="_blank" rel="external">https://help.github.com/articles/create-a-repo</a>。关于<code>Initialize this repository with a README</code>是可选的,建议选上,不选的话,需要自己本地添加上再提交到github仓库。</p>
<h3 id="本地仓库准备"><a href="#本地仓库准备" class="headerlink" title="本地仓库准备"></a>本地仓库准备</h3><p>关于SSH设置与config中的username、email设置,参照<a href="http://gcfrun.github.io/2015/11/18/mac%E4%B8%8B%E5%88%9B%E5%BB%BAhexo%E5%8D%9A%E5%AE%A2/">Hexo-mac 下搭建hexo博客全过程</a>。</p>
<p>1.选择一个本地仓库路径</p>
<p>例:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /Users/XXX/Git本地仓库</span><br></pre></td></tr></table></figure>
<p>xxx为你计算机用户名,当然路径也可以选择为待上传项目的路径。</p>
<p>2.初始化仓库</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">git</span> init</span><br></pre></td></tr></table></figure>
<p>成功后会提示<code>Initialized empty Git repository in /Users/XXX/Git本地仓库/.git/</code>,否则的话会提示本地仓库已存在,那就不需要创建了。</p>
<p>3.设置远程仓库路径</p>
<figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote add origin git<span class="meta">@github</span>.<span class="string">com:</span>xxx/xxxx.git</span><br></pre></td></tr></table></figure>
<p><code>git@github.com:xxx/xxxx.git</code>为远程仓库路径,github仓库建立成功后,右边会有个地址,选择SSH地址,复制。</p>
<p>4.获取远程最新版并merge到本地</p>
<figure class="highlight crmsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git pull origin <span class="literal">master</span></span><br></pre></td></tr></table></figure>
<h3 id="本地项目添加"><a href="#本地项目添加" class="headerlink" title="本地项目添加"></a>本地项目添加</h3><p> 把要上传的项目拷贝到本地仓库路径,确保本地仓库路径还包含一个隐藏文件.git,一个README.md文件。</p>
<h3 id="更新github仓库"><a href="#更新github仓库" class="headerlink" title="更新github仓库"></a>更新github仓库</h3><p>1.跟踪文件</p>
<figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="keyword">add </span>.</span><br></pre></td></tr></table></figure>
<p>跟踪当前路径下所有文件及子文件,命令<code>$ git add xxx</code>是跟踪某个特定文件。此时用<code>git status</code>,只要在 “Changes to be committed” 这行下面的,就说明是已暂存状态。</p>
<p>2.提交更新</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">git</span> commit -m <span class="string">'first commit'</span></span><br></pre></td></tr></table></figure>
<p><code>first commit</code>是描述语。此时用<code>git status</code>,应该显示<code>nothing to commit, working directory clean</code></p>
<p>3.上传项目</p>
<figure class="highlight maxima"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">push</span> <span class="built_in">origin</span> master</span><br></pre></td></tr></table></figure>
<p>至此大功告成,github中仓库已更新。</p>
</div>
<div class="article-info article-info-index">
<div class="clearfix"></div>
</div>
</div>
</article>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info">
<div class="footer-left">
© 2016 chaofan.gong
</div>
<div class="footer-right">
<a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
</div>
</div>
</div>
</footer>
</div>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script>
var yiliaConfig = {
fancybox: true,
mathjax: true,
animate: true,
isHome: true,
isPost: false,
isArchive: false,
isTag: false,
isCategory: false,
open_in_new: false
}
</script>
<script src="http://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
<script src="/js/main.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</div>
</body>
</html>