﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-RTY 实践出真知</title><link>http://www.cppblog.com/lauer3912/</link><description /><language>zh-cn</language><lastBuildDate>Thu, 23 Apr 2026 04:09:30 GMT</lastBuildDate><pubDate>Thu, 23 Apr 2026 04:09:30 GMT</pubDate><ttl>60</ttl><item><title>webkit webApp 开发技术要点总结,涉及ViewPort，离线浏览，缩放，事件，屏幕旋转，防止滚动条出现，双手滑动，判断设备，拼写修正，CSS等(转载)</title><link>http://www.cppblog.com/lauer3912/archive/2013/03/13/198388.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 13 Mar 2013 09:12:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/03/13/198388.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/198388.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/03/13/198388.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/198388.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/198388.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 原文：http://www.cnblogs.com/pifoo/archive/2011/05/28/webkit-webapp.htmlwebkit webApp 开发技术要点总结如果你是一名前端er,又想在移动设备上开发出自己的应用，那怎么实现呢？幸好，webkit内核的浏览器能帮助我们完成这一切。接触 webkit webApp的开发已经有一段时间了，现把一些技巧分享给大家 ：1. view...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2013/03/13/198388.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/198388.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-03-13 17:12 <a href="http://www.cppblog.com/lauer3912/archive/2013/03/13/198388.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java Gossip: 國際化訊息</title><link>http://www.cppblog.com/lauer3912/archive/2013/03/08/198288.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 08 Mar 2013 03:03:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/03/08/198288.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/198288.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/03/08/198288.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/198288.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/198288.html</trackback:ping><description><![CDATA[<h1><a href="http://caterpillar.onlyfun.net/Gossip/JavaGossip-V2/JavaGossip2.htm" style="color: #444444; text-decoration: none;"><font color="#444444">Java Gossip:&nbsp;國際化訊息</font><br /><br /></a><a href="http://caterpillar.onlyfun.net/Gossip/JavaGossip-V2/JavaGossip2.htm"><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">國際化的英文是<span style="font-weight: bold;">Internationalization</span>，因為單字中總共有18個字母，簡稱<span style="font-weight: bold;">I18N</span>，目的是讓應用程式可以應地區不同而顯示不同的訊息，最基本的就是讓不同語系的使用者可以看到屬於自己語系的訊息，像是英文語系的看到英文內容，而中文語系的可以看到中文的內容。<br /><br />為了在應用程式中表示一個區域，Java提供有<span style="font-weight: bold;">java.util.Locale</span>類，一個Locale實例包括了語系資訊與區域資訊，例如說"en"表示英文語系的國家，這個字母組合是在&nbsp;<a href="http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt" style="color: #444444; font-weight: bold; text-decoration: none;">ISO 639</a>&nbsp;中定義的，而區域資訊則是像"US"表示美國，這個字母組合則是在&nbsp;<a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html" style="color: #444444; font-weight: bold; text-decoration: none;">ISO 3166</a>&nbsp;中定義的。<br /><br />您可以這麼新增一個Locale的實例：<br /></small><div style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff; margin-left: 40px;"><small><span style="font-weight: bold; font-family: 'Courier New', Courier, monospace;">Locale locale = new Locale("zh", "TW");</span><br /></small></div><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">&nbsp;<br />如何將Locale用於訊息綁定呢？當您使用ResourceBundle.getBundle()方法時，預設就會自動取得電腦上的語系與區域訊息，而事實上訊息檔案的名稱由basename加上語系與地區來組成，例如：<br /></small><ul style="margin-top: 3px; margin-bottom: 3px; color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"><li><small>basename.properties</small></li><li><small>basename_en.properties</small></li><li><small>basename_zh_TW.properties</small></li></ul><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;"><br />沒有指定語言與地區的basename是預設的資源檔名稱，當沒有提供專用的語系、區域訊息檔案時，就會找尋預設的資源檔案。<br /><br />如果您想要提供繁體中文的訊息，由於訊息資源檔必須是ISO-8859-1編碼，所以對於非西方語系的處理，必須先將之轉換為Java Unicode Escape格式，例如您可以先在訊息資源檔中寫下以下的內容：<br /></small><ul style="margin-top: 3px; margin-bottom: 3px; color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"><li>messages_zh_TW.txt</li></ul><pre style="color: #333333; border: 1px solid #777777; background-color: #eeeeee; margin: 3px 25px; padding: 0px 10px; font-size: small; font-weight: normal; line-height: 17px; width: auto; font-family: 'Courier New', Courier, monospace;">onlyfun.caterpillar.welcome=哈囉<br />onlyfun.caterpillar.name=世界 <br /></pre><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">然後使用JDK的工具程式<span style="font-weight: bold;">native2ascii</span>來轉換，例如：<br /></small><div style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff; margin-left: 40px;"><small><em><strong>native2ascii -encoding Big5 messages_zh_TW.txt messages_zh_TW.properties</strong></em><br /></small></div><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;"><br />轉換後的內容會如下：</small><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><ul style="margin-top: 3px; margin-bottom: 3px; color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"><li>messages_zh_TW.properties</li></ul><pre style="color: #333333; border: 1px solid #777777; background-color: #eeeeee; margin: 3px 25px; padding: 0px 10px; font-size: small; font-weight: normal; line-height: 17px; width: auto; font-family: 'Courier New', Courier, monospace;">onlyfun.caterpillar.welcome=\u54c8\u56c9<br />onlyfun.caterpillar.name=\u4e16\u754c <br /></pre><p style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"></p><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">將這個檔案放於classpath可以存取的到的位置，您也可以提供預設的訊息檔案：</small><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><ul style="margin-top: 3px; margin-bottom: 3px; color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"><li>messages.properties</li></ul><pre style="color: #333333; border: 1px solid #777777; background-color: #eeeeee; margin: 3px 25px; padding: 0px 10px; font-size: small; font-weight: normal; line-height: 17px; width: auto; font-family: 'Courier New', Courier, monospace;">onlyfun.caterpillar.welcome=Hello<br />onlyfun.caterpillar.name=World <br /></pre><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">來測試一下訊息檔案，我所使用的作業系統是語系設定是中文，區域設定是台灣，當我使用下面的程式時：</small><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><ul style="margin-top: 3px; margin-bottom: 3px; color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;"><li>ResourceBundleDemo.java</li></ul><pre style="color: #333333; border: 1px solid #777777; background-color: #eeeeee; margin: 3px 25px; padding: 0px 10px; font-size: small; font-weight: normal; line-height: 17px; width: auto; font-family: 'Courier New', Courier, monospace;">package onlyfun.caterpillar;<br />&nbsp;<br />import java.util.ResourceBundle;<br /><br />public class ResourceBundleDemo {<br />    public static void main(String[] args) {<br />        ResourceBundle resource = <br />                  ResourceBundle.getBundle("messages");<br />        <br />        System.out.print(resource.getString(<br />                      "onlyfun.caterpillar.welcome") + "!");<br />        System.out.println(resource.getString(<br />                      "onlyfun.caterpillar.name") + "!");<br />    }<br />} <br /></pre><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">會使用預設的語系<span style="font-weight: bold;">"zh"</span>與區域設定<span style="font-weight: bold;">"TW"</span>，所以就會找尋messages_<span style="font-weight: bold;">zh_TW</span>.properties的內容，所以會顯示以下的訊息：</small><table border="0" cellpadding="2" cellspacing="2" style="font-family: serif; background-color: #ffffff; width: 690px;"><tbody><tr><td style="background-color: #000000;"><small><span style="color: #ffffff;">哈囉!世界!</span></small><span style="color: #ffffff;"><br /></span></td></tr></tbody></table><br style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff;" /><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">在使用ResourceBundle.getBundle()時可以給定Locale實例作為參數，例如若您想提供 messages_en_US.properties，並想要ResourceBundle.getBundle()取得這個檔案的內容，則可以如下撰寫：<br /></small><div style="color: #000000; font-family: serif; font-size: medium; font-weight: normal; line-height: normal; background-color: #ffffff; margin-left: 40px;"><small><span style="font-weight: bold; font-family: 'Courier New', Courier, monospace;">Locale locale = new Locale("en", "US");</span><br style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" /><span style="font-weight: bold; font-family: 'Courier New', Courier, monospace;">ResourceBundle resource =&nbsp;</span><br style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" /><span style="font-weight: bold; font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ResourceBundle.getBundle("messages", locale);</span><br /></small></div><small style="color: #000000; font-family: serif; font-weight: normal; line-height: normal; background-color: #ffffff;">&nbsp;<br />則取得的訊息會是messages_en_US.properties的內容。</small></a></h1><img src ="http://www.cppblog.com/lauer3912/aggbug/198288.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-03-08 11:03 <a href="http://www.cppblog.com/lauer3912/archive/2013/03/08/198288.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>project already exists delete and recreate Cordova (MacOS)</title><link>http://www.cppblog.com/lauer3912/archive/2013/02/17/197877.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 17 Feb 2013 05:12:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/02/17/197877.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197877.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/02/17/197877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197877.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197877.html</trackback:ping><description><![CDATA[根据我的环境说明一下：<br />1、Cordova的目录:/Users/kevin/Projects/HTML5/cordova-2.4.0/cordova-android<br /><br />2、AndroidSDK目录: /Users/kevin/TBB/adt-bundle-mac-x86_64/sdk<br /><br />3、设置方法：<br />（1）Terminal: 定位到Cordova的目录。<br />&nbsp; &nbsp; &nbsp; &nbsp;cd&nbsp;/Users/kevin/Projects/HTML5/cordova-2.4.0/cordova-android<br />&nbsp;（2）设置环境变量<br />&nbsp; &nbsp; &nbsp; &nbsp;export PATH=/Users/kevin/TBB/adt-bundle-mac-x86_64/sdk:/Users/kevin/TBB/adt-bundle-mac-x86_64/sdk/tools/:$PATH<br /><br />&nbsp;（3）执行 ./bin/create ~/Desktop/myapp com.myapp.special MyApp<br /><br />特殊说明：<br /><div>./bin/create /Users/kevin/CordovaProjects/Android/ChunMiaoPu com_chunmiaopu_android chunMiaoPuAndroid</div><br />会出现错误：<br /><div>An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &gt;&amp;/dev/null exited with 1</div><div>Deleting project...<br /><br /><br />只有执行如下才可以：./bin/create ~/CordovaProjects/Android/ChunMiaoPu com.chunmiaopu.android chunMiaoPuAndroid<br /><br /><br />~/MyWorkSpace/JiffAndroidApp 会自动创建JiffAndroidApp目录<br /><br /><div>devmatoMacBook-2:cordova-android kevin$ ./bin/create ~/MyWorkSpace/JiffAndroidApp me.jiff.AndroidApp JiffAndroidApp</div><div>An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1</div><div>Deleting project...</div><div>devmatoMacBook-2:cordova-android kevin$ export PATH=/Applications/eclipseForADT-20130219/sdk:/Applications/eclipseForADT-20130219/sdk/tools/:$PATH &nbsp;</div><div>devmatoMacBook-2:cordova-android kevin$ ./bin/create ~/MyWorkSpace/JiffAndroidApp me.jiff.AndroidApp JiffAndroidApp</div><div>devmatoMacBook-2:cordova-android kevin$&nbsp;</div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/197877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-02-17 13:12 <a href="http://www.cppblog.com/lauer3912/archive/2013/02/17/197877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>为你的Cocoa应用程序加入更新支持：Sparkle 简介</title><link>http://www.cppblog.com/lauer3912/archive/2013/02/07/197767.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 07 Feb 2013 06:14:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/02/07/197767.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197767.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/02/07/197767.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197767.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197767.html</trackback:ping><description><![CDATA[<h2 class="arcd-ttl">为你的Cocoa应用程序加入更新支持：Sparkle 简介</h2>
                    <p class="arcd-info"><span>发布于：2010-09-20 13:06</span><span>阅读数：3141</span></p>
                    <div class="arcd-sum">
                    	<p class="p1">作为一名桌面软件开发者，应该提早考虑程序的更新问题。如何将程序更新及时优雅的推送给用户，是维持用户忠诚度和提高软件使用体验的一个重要方面。而作为Cocoa应用程序开发者，</p>
                        
                        <span class="pun pun1">&#8220;</span><span class="pun pun2">&#8221;</span>
                    </div>
                
            	
            
            	
            		<div class="tags">
                    	
                    	
                    	<a id="read" class="font f3">阅读器</a>
                        
                    	
                    </div>
                    
                    
                    	
                    		<div id="article"><p>转自 ibuick.com，原文&nbsp; <a target="_blank" href="http://ibuick.com/index.php/archives/add-automatic-update-support-over-cocoa-app-via-sparkle-framework">http://ibuick.com/index.php/archives/add-automatic-update-support-over-cocoa-app-via-sparkle-framework</a></p>
<hr />
<p>作为一名桌面软件开发者，应该提早考虑程序的更新问题。如何将程序更新及时优雅的推送给用户，是维持用户忠诚度和提高软件使用体验的一个重要方面。而作为Cocoa应用程序开发者，我们可以选择自己手动来实现此功能，也可以选择一些优秀的开源框架。<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>就是其中之一。</p>
<p><span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>是一个非常简单且易用的Cocoa应用程序更新框架。本篇文章将使用一个简单的例子，教你如何使用<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>为你的Cocoa应用程序加入更新支持。</p>
<p>1: 新建一个Cocoa Application，TestSparkle</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401G5-0.png" alt="wpid-wpid-xcodecocoaapplication-2010-09-10-16-11-2010-09-10-16-11.png" height="415" width="544" /></p>
<p>&nbsp;</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214063Z-1.png" alt="wpid-wpid-cocoaapplicationwithsparkle-2010-09-10-16-11-2010-09-10-16-11.png" height="392" width="541" /><br />
2: 去到<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>下载<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/files/Sparkle%201.5b6.zip">Sparkle Framework</a></span>，最新版本为 1.5b6,</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214060c-2.png" alt="wpid-wpid-sparkle-2010-09-10-16-11-2010-09-10-16-11.png" height="340" width="545" /><br />
Sparkle Test App.app 是一个用来演示<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>更新框架的一个应用程序。</p>
<p>Extras文件夹下提供了<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>的标准图标，Release Notes模版，软件签名工具，源代码和Appcast.xml示例文件，我们后面会再讲到这些工具和文件。</p>
<p>With Garbage Collection, 是一个加入了Garbage Collection支持的<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>分发版，如果你的应用程序运行在有GC的环境下，则可以使用这个版本的<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span></p>
<p>Sparkle.framework 是通用分发版，笔者建议大家使用此版本的<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>。</p>
<p>3: 链接<span style="text-decoration: underline;"><a href="http://sparkle.andymatuschak.org/">Sparkle</a></span>框架到TestSparkle工程</p>
<p>拖拽Sparkle.framework(或 with Garbage Collection下的  
Sparkle.framework)到TestSparkle的Linked Frameworks下，在弹出窗口中记得选中&#8221;Copy items 
 into destination group&#8217;s folder (if needed)&#8221;前面的复选框。</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214014c-3.png" alt="wpid-wpid-addsparkletotestsparkle-2010-09-10-16-11-2010-09-10-16-11.png" height="328" width="542" /></p>
<p>4: 为你的工程新建一个Copy Files Build Phase,</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321402103-4.png" alt="wpid-wpid-addcopyfilesbuildphase-2010-09-10-16-11-2010-09-10-16-11.png" height="328" width="543" /><br />
5: 右键点击这个新建的Copy Files Build Phase，并在弹出窗口中，点击Destination下拉框，选择Frameworks</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321403625-5.png" alt="wpid-wpid-copyfilesbuildphaseforframework-2010-09-10-16-11-2010-09-10-16-11.png" height="386" width="542" /><br />
6: 将Linked Framworks下的Sparkle.framework拖拽到这个新建的Copy Files Build Phase 中</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214033D-6.png" alt="wpid-wpid-addsparkle-2010-09-10-16-11-2010-09-10-16-11.png" height="328" width="543" /><br />
7: 在Interface Builder中打开TestSparkle的MainMenu.xib(nib), 然后点击Interface Builder&#8211;&gt;Files&#8211;&gt;Read Class Files</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321403500-7.png" alt="wpid-wpid-readclassfiles-2010-09-10-16-11-2010-09-10-16-11.png" height="284" width="290" /></p>
<p>8: 将Sparkle.framework中的所有头文件选中并读取</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/132140M22-8.png" alt="wpid-wpid-readheaderfiles-2010-09-10-16-11-2010-09-10-16-11.png" height="363" width="543" /><br />
9: 从Library中拖拽一个 NSObject到MainMenu主窗口.</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321406246-9.png" alt="wpid-wpid-addobject-2010-09-10-16-11-2010-09-10-16-11.png" height="363" width="543" /></p>
<p>10: 点击此Object对象，点击Inspector，设定此Object的Class为 SUUpdater</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321405R0-10.png" alt="wpid-wpid-SUUpdater-2010-09-10-16-11-2010-09-10-16-11.png" height="355" width="301" /></p>
<p>11: 添加一个菜单项到到TestSparkle Menu，重命名为 Check For Updates&#8230;</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214024X-11.png" alt="wpid-wpid-Checkupdatesmenuitem-2010-09-10-16-11-2010-09-10-16-11.png" height="322" width="543" /></p>
<p>12: 将 Check for Updates&#8230;菜单项的Send Actions指向Updater Object的checkForUpdates方法</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214044c-12.png" alt="wpid-wpid-addactionforupdate-2010-09-10-16-11-2010-09-10-16-11.png" height="353" width="542" /><br />
13: 保存Interface Builder的所有更改，退出Interface Builder。</p>
<p>14: 为了安全防止应用程序更新遭到恶意篡改，我推荐对应用程序更新添加数字签名。</p>
<p>Sparkle使用DAS SHA-1 来对程序更新包进行数字签名。</p>
<p>打开终端，进入步骤2中存放已下载的Sparkle包的文件夹，进入Extras&#8211;&gt;Signing Tools，</p>
<p>执行,</p>
<div class="codecolorer-container bash default" style="overflow: auto; white-space: nowrap; width: 435px;">
<div class="bash codecolorer">ruby generate_keys.rb</div>
</div>
<p>这个命令将会生成两个文件 dsa_priv.pem 和 dsa_pub.pem，也就是私钥和公钥，请妥善保存这两个文件，如果私钥丢失，你得用户将再也无法自动通过已安装的程序来获得更新的更新。</p>
<p>15: 建立一个 App Cast Feed文件</p>
<p>Sparkle的运作机理其实非常简洁，本地应用程序Info.plist中含有一个URL，此URL指向一个在你网站上的App Cast  
Feed XML文件。当你发布更新的时候，上传新的app到你的网站，更新此app cast xml  
feed。这样，客户端程序在运行检查更新时，会根据Info  
Plist中的URL找到并Parse此文件，跟本地软件版本进行比对。如果发现更新，则提示用户。这就是App Cast XML  
Feed文件的作用。</p>
<p>在步骤14中提到的Extras文件夹下，有一个App Cast XML Feed文件的模版：</p>
<p>&nbsp;</p>
<p>http://you.com/app/2.0.html<br />
<br />
Wed, 09 Jan 2006 19:20:11 +0000<br />
<br />
http://you.com/app/1.5.html<br />
<br />
Wed, 01 Jan 2006 12:20:11 +0000<br />
<span class="sc-1">&lt;!-- Now here's an example of a version with a  
weird internal version number (like an SVN revision) but a  
human-readable external one. --&gt;</span><br />
http://you.com/app/1.4.html<br />
<br />
Wed, 25 Dec 2005 12:20:11 +0000</p>
<p>我们可以看出，这其实是一个标准的RSS Feed格式的XML文件。我们只要修改相应的项目即可。</p>
<p>下面我们就来一步步的演示如何使用Sparkle为你的程序加入更新支持。</p>
<p>16: 我们首先在本地搭建一个可用于测试软件更新的网站。打开Mac OS X系统偏好设置(System Preferences),  
找到共享(Sharing)，开启Web共享(Web  
Sharing)，并通过点击图中所示URL测试Web共享是否成功开启。http://10.0.1.2/~buick <span style="color: #ff0000;">你的显示可能与此不同，，，，</span></p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321402048-13.png" alt="wpid-wpid-websharing-2010-09-10-16-11-2010-09-10-16-11.png" height="454" width="542" /><br />
17: 打开你的XCode中 TestSparkle 工程，编辑 TestSparkle-Info.plist，加入两个属性，SUPublicDSAKeyFile 和 SUFeedURL</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401K7-14.png" alt="wpid-wpid-info.plist-2010-09-10-16-11-2010-09-10-16-11.png" height="412" width="543" /></p>
<p>其中，SUFeedURL 将是指向一个 App Cast XML Fee 的 URL，比如我的测试地址是 <span style="text-decoration: underline;"><a href="http://10.0.1.2/%7Ebuick/testsparkleappcast.xml">http://10.0.1.2/~buick/testsparkleappcast.xml</a></span>
  ，SUPublicDSAKeyFile 指向公钥，我们把刚才步骤14中生成的 dsa_pub.pem 加入到工程的Resources中，并在
  TestSparkle-Info.plist 中指定此公钥的名称，，，，那么现在的TestSparkle-Info.plist应该是这样</p>
<p><a rel="attachment wp-att-1106" href="http://ibuick.com/index.php/archives/add-automatic-update-support-over-cocoa-app-via-sparkle-framework/wpid-wpid-configuration-2010-09-10-16-11-2010-09-10-16-111-2"><img class="alignnone size-full wp-image-1106" title="wpid-wpid-configuration-2010-09-10-16-11-2010-09-10-16-111" src="http://www.cocoachina.com/cms/uploads/allimg/100920/132140D41-15.png" alt="" height="412" width="543" /></a></p>
<p>整个配置完成，我们现在来构建一个TestSparkle.app的1.0版本，点击Build and Run</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401T0-16.png" alt="wpid-wpid-TestSparkle-2010-09-10-16-11-2010-09-10-16-11.png" height="323" width="542" /><br />
启动TestSparkle.app, 在TestSparkle菜单下，确认Check for Updates&#8230;按钮处于可用状态，如果是灰色不可点击，则返回Interface Builder修改。</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/13214025G-17.png" alt="wpid-wpid-checkforupdates-2010-09-10-16-11-2010-09-10-16-11.png" height="242" width="227" /></p>
<p>将此 TestSparkle.app 1.0 版本拷贝到别处备用。然后返回XCode，将应用程序版本改为1.1,然后构建工程。将TestSparkle.app 的1.1版本打包成zip文件，改名为TestSparkle_1.1.zip</p>
<p>将 dsa_priv.pem (私钥) 和 TestSparkle_1.1.zip 拷贝到 Extras下的Signing Tool文件夹中，</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/132140B34-18.png" alt="wpid-wpid-signing-2010-09-10-16-11-2010-09-10-16-11.png" height="298" width="542" /></p>
<p>打开终端进入到此文件夹，执行：</p>
<div class="codecolorer-container bash default" style="overflow: auto; white-space: nowrap; width: 435px;">
<div class="bash codecolorer">ruby sign_update.rb TestSparkle_1.1.zip dsa_priv.pem</div>
</div>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401011-19.png" alt="wpid-wpid-sign-2010-09-10-16-11-2010-09-10-16-11.png" height="323" width="542" /><br />
便可得到升级包的签名，MCwCFDZsrVGB+PewvxioJcvptkqchXi3AhQOZDJ4UukRM2/bYmZzzbHTxM2kpA==</p>
<p>用文本编辑器创建一个xml文件(UTF-8 编码)，内容如下：</p>
<p>http://10.0.1.2/~buick &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The latest TestSparkle updates from localhost, more hot features and sweeties<br />
en</p>
<p>Fri, 10 Sept 2010 0:00:00 +0300 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; http://10.0.1.2/~buick</p>
<p><span style="color: #ff0000;">注意(由于本网站HTML的设置问题，如果你直接拷贝以上XML Feed文件到你本地测试可能会出编码问题导致XML Parse失败，请到本文最后下载此文件，以及工程压缩包)。</span></p>
<p>把此XML另存为 testsparkleappcast.xml</p>
<p>熟悉RSS Feed的读者可能很容易理解此文件，，如果我们在浏览器中直接访问此URL，我们会看到</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401950-20.png" alt="wpid-wpid-feed-2010-09-10-16-11-2010-09-10-16-11.png" height="380" width="543" /></p>
<p>而我们要关注的只是这两段:</p>
<p>这段指定的URL是一个介绍页面，如果你希望在更新提示窗口中出现一个介绍新版本的页面(或者说release notes)，则使用此URL定向到你网站上的新版本介绍页面。</p>
<p>Sparkle非常贴心的为大家提供了一个模版，在Extras/Release Notes Templates 文件夹下可找到</p>
<p>enclosure sparkle:version=&#8220;1.1&#8221;  
sparkle:dsaSignature=&#8220;MCwCFDZsrVGB+PewvxioJcvptkqchXi3AhQOZDJ4UukRM2/bYmZzzbHTxM2kpA==&#8220;
  url=&#8220;http://10.0.1.2/~buick/TestSparkle_1.1.zip&#8221; length=&#8220;436264&#8221;  
type=&#8220;application/octet-stream&#8221;/&gt;</p>
<p>这段是实现Sparkle Update的关键，</p>
<p>sparkle:version=&#8220;1.1&#8221; 是指当前更新包版本号，客户端程序就是根据这个版本号来和本地APP进行比对，如果发现不同则提示更新。</p>
<p>sparkle:dsaSignature=&#8220;MCwCFDZsrVGB+PewvxioJcvptkqchXi3AhQOZDJ4UukRM2/bYmZzzbHTxM2kpA==&#8220; 这个就是我们刚才为更新包生成的数字签名</p>
<p>url=&#8220;<span style="text-decoration: underline;"><a href="http://10.0.1.2/%7Ebuick/TestSparkle_1.1.zip">http://10.0.1.2/~buick/TestSparkle_1.1.zip</a></span>&#8221; 指向更新包下载地址</p>
<p>length=&#8220;436264&#8221; 指更新包的大小，上传上去前用 终端 ls -al 命令可查看</p>
<p>type=&#8220;application/octet-stream&#8221; 是一个想对固定的值，一般不用修改。</p>
<p>现在把testsparkleappcast.xml 和 TestSparkle_1.1.zip 拷贝到</p>
<p>你的用户主目录/Sites 下 (~/Sites,具体路径依你个人配置而定)</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401350-21.png" alt="wpid-wpid-path-2010-09-10-16-11-2010-09-10-16-11.png" height="352" width="543" /><br />
然后在浏览器敲入 <span style="text-decoration: underline;"><a href="http://10.0.1.2/%7Ebuick/testsparkleappcast.xml">http://10.0.1.2/~buick/testsparkleappcast.xml</a></span></p>
<p>如果能够看到类似网页，，，说明一切正常。</p>
<p>下面找到我们刚才保存的TestSparkle.app 1.0版本，运行并点击 Check for Updates&#8230; 如果一切正常，你可以看到</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321401116-22.png" alt="wpid-update1-2010-09-10-16-11.png" height="383" width="543" /></p>
<p>点击Install Update，如果更新成功，即可显示：</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/132140DG-23.png" alt="wpid-complee-2010-09-10-16-11.png" height="209" width="464" /></p>
<p>然后再次点击Check for Updates, 你会看到</p>
<p><img src="http://www.cocoachina.com/cms/uploads/allimg/100920/1321406312-24.png" alt="wpid-latest-2010-09-10-16-11.png" height="217" width="467" /></p>
<p>最后希望你与Sparkle合作愉快。</p>
<p><span style="text-decoration: underline;"><a href="https://files.me.com/buickwang555/rq9k37">点击此处下载本次工程源代码和示例XML Feed文件，另外，安装包里面还带有一个Sparkle的简体中文包，将它放入你的Sparkle.framework/Resources下即可。</a></span></p></div><img src ="http://www.cppblog.com/lauer3912/aggbug/197767.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-02-07 14:14 <a href="http://www.cppblog.com/lauer3912/archive/2013/02/07/197767.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IOS - 文字色彩</title><link>http://www.cppblog.com/lauer3912/archive/2013/02/05/197743.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 05 Feb 2013 07:24:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/02/05/197743.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197743.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/02/05/197743.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197743.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197743.html</trackback:ping><description><![CDATA[<div style="margin: 0px; padding-top: 20px; padding-right: 10px; padding-bottom: 20px; word-wrap: break-word; word-break: normal; font-family: 宋体; font-size: 12px; line-height: 24px; background-color: #ffffff;"><div id="article_content" style="margin: 0px;"><p>文字色彩</p><p>可以用一个UIColor对象来定义文字的色彩。UIColor这个类提供了许多不同的方法，可以很轻松地调出任何颜色。你可以用静态方法来创建 颜色，这样它们会在停止使用后被释放。可以用灰度值、色相或者RGB复合值等多种形式来创建颜色。要创建一个简单的RGB色彩，可以指定一组4个浮点值， 分别对应红、绿、蓝和alpha值（透明度），取值均在0.0～1.0之间。这些值表示了0%（0.0）～100%（1.0）的范围：</p><ol style="margin: 0px; padding: 0px; list-style: none;"><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myWhiteTransparentColor&nbsp;=&nbsp;[&nbsp;UIColor&nbsp;<br />colorWithWhite:&nbsp;1.0&nbsp;alpha:&nbsp;0.50&nbsp;]; &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;</li><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myColorHue&nbsp;=&nbsp;[&nbsp;UIColor&nbsp;colorWithHue:&nbsp;120.0&nbsp;/&nbsp;360.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;saturation:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;brightness:&nbsp;0.50 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alpha:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">]; &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;</li><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myColorRGB&nbsp;=&nbsp;[&nbsp;UIColor&nbsp;colorWithRed:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;green:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;blue:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alpha:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">];&nbsp;</li></ol><p>如果你打算重用许多不同的UIColor对象，你也可以创建它们的实例：</p><ol style="margin: 0px; padding: 0px; list-style: none;"><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myWhiteTransparentColor&nbsp;=&nbsp;[&nbsp;[&nbsp;UIColor&nbsp;alloc&nbsp;] &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initWithWhite:&nbsp;1.0&nbsp;alpha:&nbsp;0.50 &nbsp;</li><li style="margin: 0px; padding: 0px;">]; &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;</li><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myColorHue&nbsp;=&nbsp;[&nbsp;[&nbsp;UIColor&nbsp;alloc&nbsp;] &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initWithHue:&nbsp;120.0&nbsp;/&nbsp;360.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;saturation:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;brightness:&nbsp;0.50 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alpha:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">]; &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;</li><li style="margin: 0px; padding: 0px;">UIColor&nbsp;*myColorRGB&nbsp;=&nbsp;[&nbsp;[&nbsp;UIColor&nbsp;alloc&nbsp;]&nbsp;initWithRed:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;green:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;blue:&nbsp;0.75 &nbsp;</li><li style="margin: 0px; padding: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alpha:&nbsp;1.0 &nbsp;</li><li style="margin: 0px; padding: 0px;">];&nbsp;</li></ol><p>UIColor类还支持许多静态方法，可以创建系统颜色，这些颜色都经过iPhone的校正，以达到尽可能准确的地步。这些方法如下所示，均来自UIColor.h：</p><ol style="margin: 0px; padding: 0px; list-style: none;"><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)blackColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.0&nbsp;白色 &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)darkGrayColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.333&nbsp;白色 &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)lightGrayColor;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.667&nbsp;白色 &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)whiteColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1.0&nbsp;白色 &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)grayColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.5&nbsp;白色 &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)redColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1.0,&nbsp;0.0,&nbsp;0.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)greenColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.0,&nbsp;1.0,&nbsp;0.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)blueColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.0,&nbsp;0.0,&nbsp;1.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)cyanColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.0,&nbsp;1.0,&nbsp;1.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)yellowColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1.0,&nbsp;1.0,&nbsp;0.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)magentaColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1.0,&nbsp;0.0,&nbsp;1.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)orangeColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1.0,&nbsp;0.5,&nbsp;0.0&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)purpleColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.5,&nbsp;0.0,&nbsp;0.5&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)brownColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.6,&nbsp;0.4,&nbsp;0.2&nbsp;RGB &nbsp;</li><li style="margin: 0px; padding: 0px;">+&nbsp;(UIColor&nbsp;*)clearColor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;0.0&nbsp;白色,&nbsp;0.0&nbsp;alpha&nbsp;</li></ol><p>创建好UIColor对象之后，就可以将其赋给文本视图的色彩属性了：</p>textView.textColor&nbsp;=&nbsp;myColorHue;&nbsp;</div><div></div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/197743.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-02-05 15:24 <a href="http://www.cppblog.com/lauer3912/archive/2013/02/05/197743.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Xcode: split a NSString into NSArray</title><link>http://www.cppblog.com/lauer3912/archive/2013/02/04/197708.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 04 Feb 2013 06:22:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/02/04/197708.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197708.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/02/04/197708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197708.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197708.html</trackback:ping><description><![CDATA[NSString *str = @"011597464952,01521545545,454545474,454545444|Hello this is were the message is."; <br /> <br />NSArray *firstSplit = [str componentsSeparatedByString:@"|"]; <br />NSAssert(firstSplit.count == 2, @"Oops! Parsed string had more than one |, no message or no numbers."); <br />NSString *msg = [firstSplit lastObject]; <br />NSArray *numbers = [[firstSplit objectAtIndex:0] componentsSepratedByString:@","]; <br /> <br />// print out the numbers (as strings) <br />for(NSString *currentNumberString in number) { <br />  NSLog(@"Number: %@", currentNumberString); <br />}&nbsp;<img src ="http://www.cppblog.com/lauer3912/aggbug/197708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-02-04 14:22 <a href="http://www.cppblog.com/lauer3912/archive/2013/02/04/197708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iOS中plist的创建，数据写入与读取</title><link>http://www.cppblog.com/lauer3912/archive/2013/02/04/197707.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 04 Feb 2013 05:49:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/02/04/197707.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197707.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/02/04/197707.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197707.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197707.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">功能创建一个test.plist文件，textInput作为输入，displayLabel作为显示，有一个按钮来触发保持程序triggerStorage；</p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">-(void)triggerStorage<br />{<br />&nbsp;&nbsp;&nbsp; displayLabel.text = textInput.text;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);<br />&nbsp;&nbsp;&nbsp; NSString *path=[paths&nbsp;&nbsp;&nbsp; objectAtIndex:0];&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];&nbsp;&nbsp; //获取路径<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];&nbsp; //读取数据<br />&nbsp;&nbsp;&nbsp; NSLog(@"dic2 is:%@",dic2);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; //创建一个dic，写到plist文件里<br />&nbsp;&nbsp;&nbsp; NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:displayLabel.text,@"IP",nil]; //写入数据<br />&nbsp;&nbsp;&nbsp; [dic writeToFile:filename atomically:YES];&nbsp;&nbsp;&nbsp;<br /><br />}<br /><br />// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />- (void)viewDidLoad<br />{<br />&nbsp;&nbsp;&nbsp; NSMutableArray *resultData;&nbsp;<br />&nbsp;&nbsp;&nbsp; NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);<br />&nbsp;&nbsp;&nbsp; NSString *path=[paths objectAtIndex:0];<br />&nbsp;&nbsp;&nbsp; NSLog(@"path = %@",path);&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; //读文件<br />&nbsp;&nbsp;&nbsp; NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];<br />&nbsp;&nbsp;&nbsp; NSLog(@"dic is:%@",dic2);&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; if(dic2 == nil)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //1. 创建一个plist文件&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NSFileManager* fm = [NSFileManager defaultManager];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [fm createFileAtPath:filename contents:nil attributes:nil];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultData=[dic2 objectForKey:@"IP"];&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if([dic2 count] &gt; 0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayLabel.text = resultData;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayLabel.text = @" ";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]&nbsp;&nbsp; //按钮的初始化及触发条件设置<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initWithTitle:@"保存"&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style:UIBarButtonItemStylePlain&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target:self&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; action:@selector(triggerStorage)] autorelease];&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; [super viewDidLoad];<br />}</p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">------------------------------------------------------------------------------------------------------------------------------------------------------------</p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">参考代码：</p><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">plist&nbsp;文件读写</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;//1.&nbsp;创建一个plist文件</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSArray&nbsp;*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSString&nbsp;*path=[paths&nbsp;&nbsp;&nbsp;&nbsp;objectAtIndex:0];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSLog(@"path&nbsp;=&nbsp;%@",path);</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSString&nbsp;*filename=[path&nbsp;stringByAppendingPathComponent:@"test.plist"];&nbsp;&nbsp;&nbsp;&nbsp;</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSFileManager*&nbsp;fm&nbsp;=&nbsp;[NSFileManager&nbsp;defaultManager];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;[fm&nbsp;createFileAtPath:filename&nbsp;contents:nil&nbsp;attributes:nil];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;//NSDictionary*&nbsp;dic&nbsp;=&nbsp;[NSDictionary&nbsp;dictionaryWithContentsOfFile:plistPath];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;//创建一个dic，写到plist文件里</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSDictionary*&nbsp;dic&nbsp;=&nbsp;[NSDictionary&nbsp;dictionaryWithObjectsAndKeys:@"sina",@"1",@"163",@"2",nil];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;[dic&nbsp;writeToFile:filename&nbsp;atomically:YES];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;//读文件</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><span style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSDictionary*&nbsp;dic2&nbsp;=&nbsp;[NSDictionary&nbsp;dictionaryWithContentsOfFile:filename];</span><br style="color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;" /><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; font-size: 12px; line-height: 24px; background-color: #fcf8e9;">&nbsp;&nbsp;&nbsp;&nbsp;NSLog(@"dic&nbsp;is:%@",dic2);</p><img src ="http://www.cppblog.com/lauer3912/aggbug/197707.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-02-04 13:49 <a href="http://www.cppblog.com/lauer3912/archive/2013/02/04/197707.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>《移动应用开发解决方案》Embarcadero HTML 5 Builder </title><link>http://www.cppblog.com/lauer3912/archive/2013/01/08/197116.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 08 Jan 2013 08:31:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/01/08/197116.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197116.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/01/08/197116.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197116.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197116.html</trackback:ping><description><![CDATA[<div><div>《移动应用开发解决方案》Embarcadero HTML 5 Builder</div> <div>2012年10月28日 &#8260; <a title="查看 最新素材 中的全部文章" href="http://www.renrensucai.com/archives/category/zuixinsucai" rel="category tag">最新素材</a>, <a title="查看 行业软件 中的全部文章" href="http://www.renrensucai.com/archives/category/zuixinsucai/softplug-ins-fonts-brushes-filter" rel="category tag">行业软件</a> &#8260; <a title="《《移动应用开发解决方案》Embarcadero HTML 5 Builder》上的评论" href="http://www.renrensucai.com/archives/18983#respond">暂无评论</a> &#8260; 被围观  324 views+ </div></div> <div jquery1357633033816="72"> <div id="entry" jquery1357633033816="71"> <p jquery1357633033816="70"><img id="aimg_70813" title="002364cf_medium.jpg" alt="002364cf_medium.jpg" src="http://www.rr-sc.com/data/attachment/forum/201210/28/080506fy5btkf56ylat5t0.jpg" width="422" original="http://www.rr-sc.com/data/attachment/forum/201210/28/080506fy5btkf56ylat5t0.jpg" loaded="true" /><br />Embarcadero HTML 5 Builder | 464.2 mb</p> <p>HTML5 Builder允许开发者在可视化IDE中使用Javascript、HTML5，jQuery  mobile以及CSS3开发Web和移动应用。关心跨平台移动支持的开发者，可以使用同一份公共HTML5/CSS3/JavaScript代码，支持iOS，Android，黑莓以及Windows  Phone。HTML5 Builder不仅仅关注客户端开发，它还集成了服务端PHP以及数据库（如MySQL）的支持。<br />HTML5  Builder是增强并重命名的RadPHP。通过对客户端解决方案的更多支持，尤其是对HTML5和CSS3的支持，我们感觉新名字更适合其新能力，并且更符合当前的市场。作为一个完整的端到端Web开发解决方案，HTML5  Builder继续支持PHP后端解决方案（具体讲，就是Zend框架以及数据访问组件）。</p> <p>HTML5 Builder is Embarcadero's Web and Mobile application development  solution enabling corporate and ISV developers to visually design and create  apps for Web, iOS, Android, BlackBerry and Windows Phone using a single HTML5,  CSS3, PHP and JavaScript codebase.</p> <p>HTML5 Builder is the replacement for RadPHP in the Embarcadero product  portfolio for Web and Mobile application platforms. With this groundbreaking new  developer solution you can now build web and mobile apps with a single codebase  using web standards - and deliver your apps to users via desktop and mobile Web  browsers or natively "on device" via Apple, Android, BlackBerry and Windows  Phone mobile app stores.</p> <p>About Embarcadero Technologies<br />Embarcadero Technologies, Inc. is a leading  provider of award-winning tools for application developers and database  professionals so they can design systems right, build them faster and run them  better, regardless of their platform or programming language. Ninety of the  Fortune 100 and an active community of more than three million users worldwide  rely on Embarcadero products to increase productivity, reduce costs, simplify  change management and compliance, and accelerate innovation. Founded in 1993,  Embarcadero is headquartered in San Francisco, with offices located around the  world.</p> <div></div></div> <div> <div><a href="http://www.rr-sc.com/thread-623-1-1.html" target="_blank"><img alt="VIP服务" src="http://www.rr-sc.com/data/attachment/forum/201110/15/155221l8p60l9n9ljenxv7.jpg" /></a></div></div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/197116.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-01-08 16:31 <a href="http://www.cppblog.com/lauer3912/archive/2013/01/08/197116.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Parse .strings file with Python</title><link>http://www.cppblog.com/lauer3912/archive/2013/01/08/197108.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 08 Jan 2013 05:44:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/01/08/197108.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197108.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/01/08/197108.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197108.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197108.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Parse .strings file with PythonParse .strings file with Pythonup vote1down votefavoriteI'm trying to write a small Python script to parse the .strings file in my iPhone application project and determi...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2013/01/08/197108.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/197108.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-01-08 13:44 <a href="http://www.cppblog.com/lauer3912/archive/2013/01/08/197108.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocoa中检查文件目录是否有权限的方法</title><link>http://www.cppblog.com/lauer3912/archive/2013/01/07/197091.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 07 Jan 2013 15:24:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2013/01/07/197091.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/197091.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2013/01/07/197091.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/197091.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/197091.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">cocoa中虽然有[[NSFileManager defaultManager] fileExistsAtPath:filename]来检查文件是否可写的方法，但是对文件目录却不起作用，没办法只好自己写一个比较山寨的方法：</p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">bool IsDirectoryWritable(NSString *dir)<br />{<br />&nbsp;&nbsp;&nbsp; bool result = false;<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; if(![[NSFileManager defaultManager] fileExistsAtPath:dir])<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; NSString* fileName = [dir stringByAppendingFormat:@"/&nbsp; _#t.txt"];<br />&nbsp;&nbsp;&nbsp; NSData *data = [fileName dataUsingEncoding:NSUTF8StringEncoding];<br />&nbsp;&nbsp;&nbsp; [data writeToFile:fileName atomically:NO];<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; result = [[NSFileManager defaultManager] fileExistsAtPath:fileName];<br />&nbsp;&nbsp;&nbsp; if(result)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [[NSFileManager defaultManager] removeItemAtPath:fileName error:NULL];<br />&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; return true;<br />}<br /></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">这个方法的不好之处就是有可能用于尝试的fileName可能已经存在(虽然已经起的很奇怪了<img alt="快哭了" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/fastcry.gif" style="border: none;" />)，这样会导致返回结果不准确，也有可能测试文件创建成功了但是删除却失败了，那么也会导致下次测试不准确,。如果哪位高人有更好的办法，麻烦指教。</p><img src ="http://www.cppblog.com/lauer3912/aggbug/197091.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2013-01-07 23:24 <a href="http://www.cppblog.com/lauer3912/archive/2013/01/07/197091.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>