﻿<?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>BlogJava-Sealyu-随笔分类-iPhone</title><link>http://www.blogjava.net/sealyu/category/46336.html</link><description>--- 博客已迁移至: &lt;a href="http://blog.sealyu.com"&gt;http://blog.sealyu.com&lt;/a&gt;
</description><language>zh-cn</language><lastBuildDate>Sat, 15 Jan 2011 20:49:43 GMT</lastBuildDate><pubDate>Sat, 15 Jan 2011 20:49:43 GMT</pubDate><ttl>60</ttl><item><title>好消息！iphone版九宫格日记免费了！</title><link>http://www.blogjava.net/sealyu/archive/2011/01/16/343039.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Sat, 15 Jan 2011 16:11:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2011/01/16/343039.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/343039.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2011/01/16/343039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/343039.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/343039.html</trackback:ping><description><![CDATA[<span id="metadataLightboxUpdate" class="lcAjaxContainer" action="/WebObjects/iTunesConnect.woa/wo/35.0.0.9.7.3.1.1.1.3.3.1.1.5.13"><span class="metadataFieldReadonly">iphone版九宫格日记免费了！<br />
<br />
下载地址：http://itunes.apple.com/cn/app/id412804027?mt=8&amp;ls=1<br />
<br />
iphone版九宫格1.0版本发布后，收到很多非常好的用户建议和评价，非常感谢大家的支持！<br />
所以</span></span><span id="metadataLightboxUpdate" class="lcAjaxContainer" action="/WebObjects/iTunesConnect.woa/wo/35.0.0.9.7.3.1.1.1.3.3.1.1.5.13"><span class="metadataFieldReadonly">Sealyu</span></span><span id="metadataLightboxUpdate" class="lcAjaxContainer" action="/WebObjects/iTunesConnect.woa/wo/35.0.0.9.7.3.1.1.1.3.3.1.1.5.13"><span class="metadataFieldReadonly">决定将程序免费，方便更多用户的使用！<br />
<br />
同时Sealyu 已经连日赶出了1.1版本，近期即将发布，新版本中增加了如下功能：<br />
</span></span><label></label>
<span class="metadataFieldReadonly">
1.增加密码保护功能。 <br />
2.使用InAppSettingsKit重新实现了&#8220;设置&#8221;页面。 <br />
3.增加"设置日记标题"功能，您可以自己设置喜欢的单元格标题。 <br />
4.修改了启动画面。
</span><br />
<br />
<img src="http://www.blogjava.net/images/blogjava_net/sealyu/detail.png" alt="" border="0" /><img src="http://www.blogjava.net/images/blogjava_net/sealyu/popup.png" alt="" border="0" /><br />
<img src="http://www.blogjava.net/images/blogjava_net/sealyu/setting-cn.png" alt="" border="0" /><img src="http://www.blogjava.net/images/blogjava_net/sealyu/splash.png" alt="" border="0" /><br />
<img src="http://www.blogjava.net/images/blogjava_net/sealyu/header.png" alt="" border="0" /><img src="http://www.blogjava.net/images/blogjava_net/sealyu/protect.png" alt="" border="0" /><br />
<br />
九宫格日记1.1版本已经提交app store审核，近期即将发布！敬请下载试用！<br />
<img src ="http://www.blogjava.net/sealyu/aggbug/343039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2011-01-16 00:11 <a href="http://www.blogjava.net/sealyu/archive/2011/01/16/343039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iphone版九宫格日记进入美国App Store新品推荐榜</title><link>http://www.blogjava.net/sealyu/archive/2011/01/12/342817.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Wed, 12 Jan 2011 01:54:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2011/01/12/342817.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/342817.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2011/01/12/342817.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/342817.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/342817.html</trackback:ping><description><![CDATA[今天早上突然发现annie里面加了一个黄色的小星星：&#8220;Featured in App Store&#8221;.<br />
看了一下，原来是进了美国区App Store中Utilities类的新品推荐榜， 非常高兴。最近要抓紧时间，赶紧加新功能了。<br />
<br />
下面图中的第一个就是了：<br />
<img src="http://www.blogjava.net/images/blogjava_net/sealyu/diary9-1.jpg" alt="" border="0" /><br />
<br />
<img src="http://www.blogjava.net/images/blogjava_net/sealyu/diary9.JPG" alt="" border="0" /><br />
<img src ="http://www.blogjava.net/sealyu/aggbug/342817.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2011-01-12 09:54 <a href="http://www.blogjava.net/sealyu/archive/2011/01/12/342817.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iphone版“胎教吧”终于通过App Store审核了</title><link>http://www.blogjava.net/sealyu/archive/2010/12/15/340826.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Wed, 15 Dec 2010 12:57:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/12/15/340826.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/340826.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/12/15/340826.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/340826.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/340826.html</trackback:ping><description><![CDATA[今天iphone版的&#8220;胎教吧&#8221;终于通过审核了，这是我开发的第一个iphone程序，程序地址：<a href="http://itunes.apple.com/app/id407952616?mt=8">http://itunes.apple.com/app/id407952616?mt=8 </a><br />
通过这个程序的开发，对xcode中Coredata和av两个framework有了初步的了解，逐渐熟悉了Objective-C和xcode的开发风格。
<img src ="http://www.blogjava.net/sealyu/aggbug/340826.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-12-15 20:57 <a href="http://www.blogjava.net/sealyu/archive/2010/12/15/340826.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Icon sizes + filenames for iOS devices</title><link>http://www.blogjava.net/sealyu/archive/2010/12/03/339750.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 03 Dec 2010 13:23:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/12/03/339750.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/339750.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/12/03/339750.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/339750.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/339750.html</trackback:ping><description><![CDATA[<p>Hopefully someone else will find these useful. Distilled from the <a href="http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html">Apple guide</a></p>
<ul style="list-style-type: none; padding: 0px; margin: 0px;">
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon.png &#8211; Home screen icon for iPhone 3 (57&#215;57)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon@2x.png &#8211; Home screen icon for iPhone 4 (114&#215;114)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-72.png &#8211; Home screen icon for iPad (72&#215;72)</li>
</ul>
<ul style="list-style-type: none; padding: 0px; margin: 0px;">
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small.png -&nbsp;Settings/Spotlight icon for iPhone 3 (29&#215;29)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small@2x.png &#8211; Settings/Spotlight icon for iPhone 4 (58&#215;58)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small-50.png &#8211; Spotlight icon for iPad (50&#215;50)</li>
</ul>
<ul style="list-style-type: none; padding: 0px; margin: 0px;">
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">iTunesArtwork &#8211; Icon for iTunes AdHoc distribution (512&#215;512)</li>
</ul>
<p>Had a request to make the work flow a little easier heres those icons in descending size order</p>
<ul style="list-style-type: none; padding: 0px; margin: 0px;">
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">iTunesArtwork &#8211; Icon for iTunes AdHoc distribution (512&#215;512)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon@2x.png &#8211; Home screen icon for iPhone 4 (114&#215;114)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-72.png &#8211; Home screen icon for iPad (72&#215;72)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small@2x.png &#8211; Settings/Spotlight icon for iPhone 4 (58&#215;58)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon.png &#8211; Home screen icon for iPhone 3 (57&#215;57)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small-50.png &#8211; Spotlight icon for iPad (50&#215;50)</li>
    <li style="margin: 0px 0px 0px 30px; list-style-type: disc; padding: 0px;">Icon-Small.png -&nbsp;Settings/Spotlight icon for iPhone 3 (29&#215;29)</li>
</ul>
<img src ="http://www.blogjava.net/sealyu/aggbug/339750.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-12-03 21:23 <a href="http://www.blogjava.net/sealyu/archive/2010/12/03/339750.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>敏捷初哥忏悔录(转)</title><link>http://www.blogjava.net/sealyu/archive/2010/11/23/338824.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Tue, 23 Nov 2010 08:54:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/23/338824.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338824.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/23/338824.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338824.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338824.html</trackback:ping><description><![CDATA[<p>在职业生涯的大部分时间里，我都是按照瀑布模型的方式进行工作。不久之后，我加入了Xebia，开始以敏捷的方式做活。特别是，我们一直把遵循
Scrum和XP方法论与TDD相结合作为重点强调的实践。从瀑布模型到敏捷的转变，就像从宇宙中的一颗行星突然跨到另一颗一样巨大。一旦完成这种转变，
你的世界将发生翻天覆地的变化，你的思维、工作或协作方式等等，所有一切都会改变。</p>
<div class="vendor-content-box-float">
<h3>相关<span class="vendor">厂商</span>内容</h3>
<p class="entrypdf f_vcrembed">
<a href="http://www.infoq.com/cn/vendorcontent/show.action?vcr=1169" target="_blank">
敏捷全球之旅来到中国：青岛地区免费报名（11月27日）
</a>
</p>
<p class="entrypdf f_vcrembed">
<a href="http://www.infoq.com/cn/vendorcontent/show.action?vcr=664">
Adobe Flash Builder 4简体中文正式版高速下载
</a>
</p>
</div>
<p>我参加的队伍由8名专业人士组成，出乎我意料的是我们中有6个之前根本没有任何采用敏捷完成工作的经验。这样，我们在其中2名有经验的同伴指导下开
始工作了。一开始，让人高兴的事情并不多，大部分的事情都让人感到沮丧。我们认识到，敏捷并不只是冲刺（Sprint）和没有文档 -
有不少细微之处你得花功夫学才行。</p>
<p>这里说明一下曾经发生过的事情：</p>
<h2>开始的麻烦</h2>
<ol>
    <li>
    <h3>思维转变</h3>
    </li>
</ol>
<p>敏捷讲的全是当下的考量、当前的冲刺、当前的用户故事等。当一路走来突然有其他某个故事出现在面前的时候，我们并不会事先考虑事情将如何发展。过去
在瀑布模型里，我们常常是首先考虑整个系统，HLD（高层设计）和LLD（低层设计）是第一步，在继续前进之前，它们必须冻结。</p>
<p>相反，敏捷的内容完全是当前状态和不断改变，要是我们的需求未来会变化，我们的设计也将随之演变；但是我们对于超越当前冲刺的事情并不是特别关注。要接受这一事实得花点时间。</p>
<ol start="2">
    <li>
    <h3>持续换档</h3>
    </li>
</ol>
<p>敏捷是一个不断变化的环境。&#8220;响应变化&#8221;是其主导原则之一。为了响应，开发者必须跟市面上的技术保持同步，否则它将让你异常痛苦。</p>
<p>我们曾在项目中使用了一种搜索引擎库，但我们中只有一人对其有了解。由于这个缺陷，我们在估时、结对、站立式会议，以及其他日常实践里都遇到了问题。</p>
<p>我们面对的另一个问题是恰当地进行TDD。从技术观点看，TDD已经有了不少选择。你可以依赖不同的模拟和测试框架，这些往往都是你在瀑布模型里不使用的东西。要是你想采用TDD，那么就必须具备对它们的丰富知识，否则整个过程就不会太顺利。</p>
<h2>缓慢地冲刺</h2>
<ol>
    <li>测试驱动开发说的是先写测试，然后由测试导出业务逻辑。这是最难适应的事情之一，因为它完全颠覆了你的观念。
    <p>在瀑布模型里，总是代码先完成，然后再进行些测试（通常都有，但并非总是有）；但TDD则完全是红、绿和重构。这种方法要求我们用抽象术语
    进行思考，然后由它们演变出具体的事物。由于一开始难以适应，我们往往求助于先写出逻辑，然后确保存在覆盖它们的测试。我把这称为开发驱动测试（DDT）
    方法。</p>
    <p>DDT并没有增加太多的意义。假如你知道你的代码将会很好地工作，那为何还要写个测试呢？只是要证明这段代码确实有效？应该不止这一点。的确是这样。例如，写测试可以让你的代码在耦合性方面表现更好，而且还能够为将来的代码变更提供一个巨大的安全网。</p>
    </li>
</ol>
<ol start="2">
    <li>在敏捷里，以抽象术语进行思考是开发人员必须具备的技能。在敏捷中我们并不像瀑布模型那样进行预先设计，通过创建抽象和开发工作流，设计到了一定的时候自然就会现身。敏捷中的开发人员必须至少精通基本的设计模式，否则他们将产生一大堆垃圾代码，从中只能得出拙劣的设计。
    <p>TDD在这里对我们大有帮助。它要求我们按抽象术语进行思考。此外，只要我们开始修改测试，我们就必须考虑进行重构，让我们的代码变得更
    好。DDT也能帮助我们立即识别任何质量问题，这样它们就能及时地得到修复。这样，我们最终认识到必须抛弃&#8220;首先编代码，然后写测试&#8221;的套路，后来我们重
    新开始采用了TDD方法。</p>
    </li>
</ol>
<ol start="3">
    <li>代码质量是团队的职责，团队成员将时不时的重构代码或者可能会重新编写，直到它符合预先制订的标准。我们不要把任何情绪跟我们的代码关联
    起来，应该准备不断地抛弃或重写它。遵循Venkat
    Subramaniam在集体所有制实践方面的建议：&#8220;每次执行检入代码操作时，我们都应该致力于改善代码的质量。&#8221;</li>
</ol>
<ol start="4">
    <li>在瀑布模型里，需求是要签字的，有点像血誓，然后你再继续向前移动。但在敏捷里，需求与解决方案同步演变。这帮助我们在前进的过程中让事
    情变得越来越清晰，但这也导致系统需要不时的重新设计，在最初的冲刺（1-4）里，这种情况经常会发生。此外，Backlog也能在冲刺的中间改变，因
    此，团队应该根据这些变化进行调整，因为在每个冲刺结束时交付可工作的软件是敏捷的座右铭。</li>
</ol>
<ol start="5">
    <li>结对一开始让人觉得是浪费时间和精力。两人一起在同一故事上进行工作就像是各浪费了一半的时间和精力。而且，多人完成同一故事的不同任务似乎是导致速度下降的原因。
    <p>但是，敏捷中的团队钟情于这种合作做事的方式，不喜欢相同项目组或房间里的人单枪匹马地干活。当团队一起工作时，他们会竭尽所能地把事情向前推进，结果你有极大的可能性是以一致的方式完成事情，而不是最终在多个战线失利。</p>
    </li>
</ol>
<ol start="6">
    <li>在采用TDD时，结对的效果最好。Driver和Navigator一起努力开发更好的系统。但如果你是按照DDT的方式进行结对编程，
    那它就不是最佳的前进之路。在这种情况下，两个合作者都不会知道该如何前进，例如系统设计应该像什么样子，这样你将得到很多噪音，产生最终必须重写的一堆
    源代码文件。
    <p>遵循TDD是最佳的方式，但要是你还没有适应它，你仍然可以结对：利用一块玻璃（白）板，首先画出某个设计流程图，然后其中一个合作者可以编写代码，而另一个则可以编写测试用例。</p>
    </li>
</ol>
<ol start="7">
    <li>在演示时交付可工作的软件就像是冲刺的&#8220;石蕊测试&#8221;。但是，要是软件不是可发布的，你会不会仅仅因为软件可以构建、可工作，而认为一个冲刺就成功了呢？
    <p>当个别故事全部完工而某些没有，这样的冲刺算不算成功呢？那假如冲刺的全部故事基本完成但还有些烦人的小问题呢？</p>
    <p>团队应该关注让整个故事完工，所有问题得到解决，并且满足完工标准；而不是慌慌张张地盯着Backlog马虎了事。一次实施蹩脚的冲刺没有
    任何意义，除了在继续前进之前必须将已完成的事情返工。时间常常是一个约束条件，因此根据故事的相对重要程度，团队应该找出一种对他们提议的解决方案更具
    质量意义的实施方法。位于Backlog顶端的故事必须尽量以最好的方式开发解决，随着我们逐渐移动到Backlog的底部，对解决方案的质量可能会有些
    妥协，但并不是对完工标准而言。对于故事的实现，更好的方式是宁缺勿滥。</p>
    </li>
</ol>
<ol start="8">
    <li>站立式会议是铁律。它们意味着成为一个共享平台，不只是你个人的有机会告诉其他人你做过什么和接下来要做什么。人们应该试图去倾听周遭发生的事情，而不只是检查自己的检查表看完成了哪些活动。
    <p>庄严的站立式会议也必须控制在一定时间之内。我们常常会抑制不住开始就某个问题进行讨论的诱惑，但那是必须要避免的。</p>
    </li>
</ol>
<ol start="9">
    <li>敏捷团队相当小，在这样一个环境里，人们经常会因为他们在站立式会议上的言论而被他人评判。那么，你就应该说我们在彼此进行脑力激荡或者我昨天什么也没做，再或者是我们重构了代码，而现在我搞不清楚怎么回事了之类的事情吗？这些都只会给新人造成一种尴尬的局面。</li>
</ol>
<ol start="10">
    <li>计划会议肯定是费脑子和让人精疲力竭的活儿。坐在椅子里4个钟头确定故事点数就像是在玩轮盘赌。这些数字将决定包含在冲刺里的内容，但是怎样在你根本没有经验的时候决定数字呢？你一定会估计错误。
    <p>但这些数字注定就是可能会出错的大致数字，这并不意味着你纯粹是靠运气来开始玩轮盘赌。这些数字在未来的几个冲刺之后将给予你某种指示，告诉你能够完成的工作量。</p>
    </li>
</ol>
<ol start="11">
    <li>分配故事点数是一个复杂的任务，应该按阶段完成。团队内部应该首先分析故事，并与产品负责人进行讨论以清晰地了解需求。在得到清晰的视图
    之后，就要进行广泛的技术讨论，考虑可以实现的最佳可能解决方案。这步要是完成不好，将导致在故事应该如何实现方面模棱两可，进而导致有缺陷的估计。假
    设，如果某个故事接触到了一个新的未探索领域，那么它应该会相当复杂，即便它是一个简单的任务。即使在已知领域，技术解决方案的不同也会导致故事相当复
    杂。
    <p>简单干脆的故事最容易被估算，即清楚地知道需求是什么，再加上点应该如何实现的细节。产品负责人无法提供这么干脆的故事。它们只能通过跟团队一起讨论得出来。因此，团队必须花点时间来为下一个冲刺进行调整。</p>
    </li>
</ol>
<ol start="12">
    <li>回顾就像是在投票时间被赐予的演讲。我们应该已经完成这个或那个，在下一个冲刺里我们可以完成这个或那个，但是要是这个冲刺里没有接受某
    些活儿，什么都不会发生。人们可以表达出对于不同方面的满意与否，但是团队应该着眼于从回顾的观点里得到某些具体任务，否则境况将永远保持下去。</li>
</ol>
<p>在扎进敏捷之前，你可以做点准备工作：</p>
<ol>
    <li>熟悉市面上的技术，尤其是像JUnit、Fitnesse、EasyMock这样的测试工具。此外，人们应该不断地为更好的解决方案而奋斗，因此出去找找改进流程的新工具和新方法，寻找解决反复出现的问题的新框架或新设计思想和模式。</li>
</ol>
<ol start="2">
    <li>Venkat Subramaniam和Andy Hunt的&#8220;高效程序员的45个习惯：敏捷开发修炼之道&#8221;是每位涉足敏捷的开发者的必读书籍。</li>
</ol>
<ol start="3">
    <li>读读Robert C Martin在objectmentor.com上的&#8220;Craftsman series&#8221;和&#8220;Clean Code&#8221; 。一开始，你可以不用急着去读它们，但在你碰到一堆麻烦的时候，你就会知道什么时候该去读了。</li>
</ol>
<ol start="4">
    <li>在站立式会议/计划/讨论，人们评估你建议的时候中保持一颗开放的心。说出你的观点，或者必要的时候要求帮助，你是这个项目的受益人。</li>
</ol>
<ol start="5">
    <li>测试不仅仅是为了代码覆盖率或质量度量。它们还提供了某种类型的持续保持更新的文档。人们可以先看看测试代码，然后就知道该如何使用这段代码了。</li>
</ol>
<ol start="6">
    <li>在项目开始就自动化构建过程的所有事情。如果像Checkstyle这样的小事都遗漏了，那么它的结果跟其他模型里的一样，说得多做得少。当你意识到这一点，求助于某种补救手段时，时间往往都太晚了。</li>
</ol>
<p>学会说A到Z，然后再让你忘记，重新学Z到A往往不会太容易。这会带来些痛苦，但完成转变之后，你就会知道这样做是值得的。</p>
<p>话就说这么多，同志们，上路吧！！:)</p>
<p>查看英文原文：<a href="http://www.infoq.com/articles/agile-confessions-sharma">Confessions of A New Agile Developer</a></p>
<img src ="http://www.blogjava.net/sealyu/aggbug/338824.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-23 16:54 <a href="http://www.blogjava.net/sealyu/archive/2010/11/23/338824.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IPhone程序发布到应用程序商店的流程（转）</title><link>http://www.blogjava.net/sealyu/archive/2010/11/23/338775.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Tue, 23 Nov 2010 04:46:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/23/338775.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338775.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/23/338775.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338775.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338775.html</trackback:ping><description><![CDATA[<p>用传真机试过N次，又用faxzero试过N次以后，全部都提示失败。但是，世事如此难料，今天凌晨收到了信用卡境外消费99美元的短信提醒，早上起来信箱里就已经收到了激活码，点击链接就激活了自己的开发者账号。也不知道是哪一次传真发成功了。</p>
<p>登录开发者中心，右侧有个Portal的链接，点击进去就是自己账号的管理中心，初次进入有个向导，可以帮你创建一个开发者证书。最好是下载它的完
整的向导说明书，是一个PDF，7M多，步骤还是挺详细的。但是这本手册在网上没有见过中文版的说明，所以在这里简单介绍一下。</p>
<p>这个开发者中心的用户权限分三种类型：Agent，Admin，Developer。Agent拥有完整的管理权限，Admin也可以管理用户和证
书，Developer只能管理自己的证书和设备。只有Agent有上传软件到App
Store的权利。（但是我没有看到添加其它用户的功能，可能需要299美元的账号类型才会有，我自己的账号登录进来就是个Agent了）。</p>
<p>对于个人开发者，你需要完成以下几个过程：</p>
<p>申请一个Development证书 &gt; 设置你的IPhone手机 &gt; 创建一个App ID &gt;
创建并下载安装一个Development Provisioning
Profile。经过这几步，你写的程序就可以跑在自己的手机上了（否则只能在虚拟机里面运行）。</p>
<p>然后申请一个Distribution证书 &gt; 创建并安装一个Distribution Provisioning Profile &gt; 编译你的程序 &gt; 就可以发布到App Store了。</p>
<p></p>
<p>下面详细介绍一下：（不知道有没有必要，毕竟买了证书的人都可以下载到这篇很简单的英文文档），所有的介绍以中文版的Mac OS X的菜单和程序名为准</p>
<p><strong>开发者证书安装步骤：</strong></p>
<p>打开应用程序中的&#8220;钥匙串访问&#8221;，在菜单里点击&#8220;证书助理&#8221;下面的&#8220;从证书代理请求证书&#8221;，注意下面不要选中任何行，否则菜单会变。输入自己的注册
Email，常用名称可以写详细一点，比如&#8220;Unfish Dev
Key&#8221;，下面选中&#8220;存储到磁盘&#8221;，点继续，可能会出现未知错误，多试几次就OK了。然后在浏览器中进入开发者中心的Certificaties导航页
面，在Development页面中最下面选择刚才创建的证书文件，点上传。然后证书就会显示出来，还要再点一下后面的Approve按钮，页面刷新后这
个证书就可以下载了。下来是个cer文件，双击会自动导入，导入类型选择&#8220;登录&#8221;就可以。</p>
<p>然后是添加自己的手机设备到xcode。把手机连到电脑上，在xcode的windows菜单下打开Organizer，左边的devices下面
会列出你的手机，右边的Identifier项就是你的手机的udid，复制下来，待会要用。如果这个手机还没有设置过作为开发机，这个界面上应该会有两
个按钮，点一下就可以把它设为开发机，在xcode里点Build and
go的时候就可以自动的安装你的程序到手机上，不需要通过ITunes了。在开发者中心的左边Devices导航页里点Add
Device，起个自己认识的名字，把udid粘贴进去就可以了。（这一步只是开发证书有用，发布证书是不需要这个东西的。）</p>
<p>然后需要创建一个App ID，在开发者中心的App IDs导航页创建一个新的App ID，这个App ID需要跟程序的info.plist里面定义的程序Identifier相对应，如果这里只输入一个*，那么info.plist那里写什么都可以，建议用*。</p>
<p>然后进入开发者中心的Provisioning菜单，在Development页面创建一个新的Provisioning，需要选择所使用的证
书，App
ID，和对应的设备，生成以后下载这个provisioning文件，把下载下来的文件拖到Dock上的Xcode的图标上就会自动安装进去。然后退出
xcode重新打开，打开你的项目，打开Project菜单下面的Edit Project Settings，进入Build页面，找到下面的Code
Signing Identity，把Any iPhone OS
Device项后面选中你的开发者证书，然后就可以把项目的编译目标设为Device（而不是模拟器），试一下Build and
Go了。程序应该会编译完并自动安装到你的手机上，并自动启动了。</p>
<p><strong>发布证书安装步骤：</strong></p>
<p><span style="text-decoration: line-through;">再使用钥匙串访问里面的&#8220;从证书代理请求证书&#8221;功能，输入自己的Email，名称要写购买证书时登录的公司名或者个人名，下面选中&#8220;保存到磁盘&#8221;和&#8220;让我自己选择私钥&#8221;，下一步，把证书保存下来。</span></p>
<p>进入开发者中心Certificates里面的Distribution页面，选择前面保存的文件上传，然后Approve一下，下载这个证书，双击导入，类型选登录。</p>
<p>进入开心者中心Provisioning里面的Distribution页面，添加新的Provisioning，类型选App
Store，（如果选了Ad Hoc，就只有你添加过udid的手机才能安装这个程序了），证书应该是自动出现的，App
ID选好，创建完成，下载这个文件，拖到xcode的图标上安装完成。退出xcode再重新打开，否则加载不了你刚刚添加的那个证书，会出现
Provisioning无效的提示。</p>
<p>然后打开你的项目，进入&#8220;Edit Project
Settings&#8221;，进入Configuration页面，选中Release点击下面的Duplicate，复制一个新的配置项出来，命名为
Distribution。然后进入Build页面，顶上的Configuration下拉框选中Distribution，下面的Code
Signing Identity里面的Any iPhone OS
Device后面对应的值选中你的那个Distribution的证书。然后就可以编译程序了。</p>
<p>如果你之前按照类似这个教程<a title="http://www.weiphone.com/thread-222380-1-3.html" href="http://www.weiphone.com/thread-222380-1-3.html">http://www.weiphone.com/thread-222380-1-3.html</a>自己生成过证书并且改过Project Settings和info.plist，需要把这两个地方改回去，否则编译的时候会出现一个warning，CodeSign warning: <em>provisioning is not applicable for product type</em> &#8216;<em>Application</em>&#8216;
in SDK &#8216;Device &#8211; iPhone OS 2.2&#8242;。删掉Project
Setting里面的PROVISIONING_PROFILE_ALLOWED =
NO和PROVISIONING_PROFILE_REQUIRED =
NO，以及info.plist的SignerIdentity，再编译，应该就不会出错了。</p>
<p>程序发布到应用程序商店的步骤：</p>
<p>在开发者中心的Distribution导航里面的App Store页面，在下面的App Store下面的Learn
More展开，就可以看到Go to iTunes Connect的链接。进入以后点击Manage My
Application，就可以添加自己的程序了。</p>
<p>需要选择程序的语言，国家，介绍等等基本信息，然后下一步上传程序和其它图片。这个地方上传的程序，就是把你的项目编译以后生成的那个.app的目
录直接压缩成zip上传，（这个.app目录里面的任何文件都不可以更改，否则签名就不对了）。你需要准备一张512&#215;512的png图片作为大
Logo，还需要准备5张程序运行的界面截图，在这个页面上挨个选Choose file，再点击upload
file，出现对号就没问题了。然后选择程序的价格，默认有很多可以选，free是免费，1是0.99美元，2是1.99美元，诸如此类。如果非免费程
序，你还得准备一份购买协议。</p>
<p>再点下一步，就可以等待程序审核了。</p>
<p>感觉似乎很复杂，不过只要按教程上的步骤一步一步的做，肯定是没有问题的。</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/338775.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-23 12:46 <a href="http://www.blogjava.net/sealyu/archive/2010/11/23/338775.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iphone app 如何联机调试和发布程序(99$) (转)</title><link>http://www.blogjava.net/sealyu/archive/2010/11/23/338774.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Tue, 23 Nov 2010 04:45:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/23/338774.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338774.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/23/338774.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338774.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338774.html</trackback:ping><description><![CDATA[<div class="postbody entry clearfix">
<p>原帖地址&nbsp;&nbsp;<a href="http://www.cocoachina.com/bbs/read.php?tid-7923.html">http://www.cocoachina.com/bbs/read.php?tid-7923.html</a></p>
<p>这两天公司让整理文档，一直想写一篇更详细的联机调试的文档，这次刚好是机会<br />
我写的只是联机调试的步骤，并没有深入的去写为什么这么做（关键是我不知道）<br />
希望这篇文章对菜鸟们有帮助，<br />
高手们见了了就不要笑了~~</p>
<p>明天再接着写如何发布程序</p>
<p>必须条件：<br />
99$<br />
(没这个就不用再往下看了)<br />
我的系统是10.5.7&nbsp;&nbsp; 不同版本的系统，可能有点小小的区别<br />
首先登录到<br />
<a id="url_1" href="http://developer.apple.com/iphone/index.action" target="_blank">http://developer.apple.com/iphone/index.action</a></p>
<p>如果已经购买了99$, 登录进去后会看到如下地方(图1)<br />
&nbsp;&nbsp;<span id="att_4277"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062540Blx.jpg" alt="" border="0" /></span></p>
<p>点进去会看到如下界面(图2)<br />
&nbsp;&nbsp;<span id="att_4278"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062540Zhc.jpg" alt="" border="0" /></span></p>
<p>这里我要提一下，公司和个人的$99&nbsp;&nbsp;Team里面的内容是有所不同的(至少我发现有不同)<br />
公司的Team下面可以加入Member&nbsp;&nbsp;而个人的不能加入Member只能是一个人，不过这里并无大碍，不妨碍我们下面的内容。<br />
点击进入 Certificates 看到如下内容(图3)<br />
<span id="att_4279"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062540NMh.jpg" alt="" border="0" width="700" /></span></p>
<p>点击图中红色部分 会下载下来一个名字为&nbsp;&nbsp;AppleWWDRCA.cer&nbsp;&nbsp;的东西<br />
这个是调试发布IPHONE
程序必须的一个东西，这个东西我们只要下载一次就够了，即使你有N个IDP，那么无论是调试程序，还是发布程序，那也只需要一个，后面我们要说到
Distribution页面时，也有这个链接，如果已经下载过，那么就不用再下这个了。(最初因为对这个流程不懂，我下载了N次这个)，<br />
下完之后，点击这个，这个东西就会装到自己的机器上。<br />
打开你的&nbsp;&nbsp;Keychain Access ，如果dock里面没有到 C盘 ApplicationsUtilities下面去找Keychain Access，中文名字好像叫&#8221; 钥匙串&#8230;&#8221; 打开这个，你会看到如下(图4)<br />
<span id="att_4280"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062540PUj.jpg" alt="" border="0" width="700" /></span></p>
<p>这代表你已经装进去了。</p>
<p>下面，我们打开Keychain的这个菜单(图5)<br />
&nbsp;&nbsp;<span id="att_4281"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062541pno.jpg" alt="" border="0" width="700" /></span></p>
<p>按着下面的图来<br />
(图6)<br />
&nbsp;&nbsp;<span id="att_4282"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062541vbt.png" alt="" border="0" /></span></p>
<p>(图7)<br />
&nbsp;&nbsp;<span id="att_4283"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062542BcK.png" alt="" border="0" /></span></p>
<p>(图8)<br />
&nbsp;&nbsp;<span id="att_4284"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062542XzI.png" alt="" border="0" /></span></p>
<p>然后continute<br />
就会生成一个CertificateSigningRequest.certSigningRequest 的文件，在你的桌面上哦</p>
<p>下一步(图9)：<br />
&nbsp;&nbsp;<span id="att_4285"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062543YOz.jpg" alt="" border="0" width="700" /></span></p>
<p>点击Request Certificate(图10)<br />
&nbsp;&nbsp;<span id="att_4286"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062543SXO.png" alt="" border="0" width="700" /></span></p>
<p>点击Choose File（图11）<br />
<span id="att_4287"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062543WdZ.png" alt="" border="0" width="700" /></span><br />
选中CertificateSigningRequest.certSigningRequest</p>
<p>点击Choose（图12）<br />
&nbsp;&nbsp;<span id="att_4288"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062544bgd.png" alt="" border="0" width="700" /></span></p>
<p>点击Submit<br />
(图13)<br />
&nbsp;&nbsp;<span id="att_4289"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0625444va.png" alt="" border="0" width="700" /></span></p>
<p>点击Approve<br />
（图14）<br />
&nbsp;&nbsp;<span id="att_4290"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062544Bnp.png" alt="" border="0" width="700" /></span></p>
<p>这时你的证书是牌Pending的状态<br />
刷新一个网页，OK就处于如下状态<br />
（图15）<br />
&nbsp;&nbsp;<span id="att_4291"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062544DQJ.png" alt="" border="0" width="700" /></span></p>
<p>这时点击 Download按钮，会得到一个developer_identity.cer&nbsp;&nbsp; 双击这个文件<br />
（图16）<br />
&nbsp;&nbsp;<span id="att_4292"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062545ABF.png" alt="" border="0" /></span></p>
<p>点击OK<br />
这时再打开你的keychain 看看 会是如下结果<br />
（图17）<br />
&nbsp;&nbsp;<span id="att_4293"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062545XOQ.png" alt="" border="0" width="700" /></span></p>
<p>切记这时能看到下面那个 钥匙 状的东西，如果没有这个，是不可能调试的，以前有时，我经常看不到那个 钥匙 状的东西<br />
OK，我们继续</p>
<p>打开Devices 那一项<br />
(图18)<br />
&nbsp;&nbsp;<span id="att_4294"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062546i0A.png" alt="" border="0" width="700" /></span></p>
<p>点击 Add Devices<br />
（图19）<br />
&nbsp;&nbsp;<span id="att_4295"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062546ZdR.png" alt="" border="0" width="700" /></span></p>
<p>给自己的设备取个名字例如MyIPod<br />
DeviceID 就是自己IPod或IPHONE的机身号（40位），机身号的获取方法有很多，可能通过 xcode 的window-&gt;Organizer 来取得<br />
(图20)<br />
&nbsp;&nbsp;<span id="att_4296"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062546Rpy.png" alt="" border="0" width="700" /></span></p>
<p>然后填入表中并点击summit<br />
图21<br />
&nbsp;&nbsp;<span id="att_4297"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062547qOG.png" alt="" border="0" width="700" /></span></p>
<p>下面我们来搞APPID<br />
图22<br />
<span id="att_4298"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0625479XD.png" alt="" border="0" width="700" /></span><br />
点击NewAppID</p>
<p>图23<br />
&nbsp;&nbsp;<span id="att_4299"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062548VpI.png" alt="" border="0" width="700" /></span><br />
第一处，随便写个名字就行了， 我以AppID为例<br />
第二处，一定要注意了，一定要按着这样的格式写<br />
我这里写的是<br />
com.abc.*<br />
你也可以写成 com.xyz.*&nbsp;&nbsp;&nbsp;&nbsp;com.google.*&nbsp;&nbsp;<br />
尽量中间那个变量有点意义，一般情况下是公司的名字。<br />
切记一定要写成这种格式，不然以后会有麻烦<br />
然后submit<br />
图24<br />
<span id="att_4300"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062548VoK.png" alt="" border="0" width="700" /></span></p>
<p>继续Provisioning页面<br />
图25<br />
&nbsp;&nbsp;<span id="att_4301"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062548sc9.png" alt="" border="0" width="700" /></span><br />
点击New Profile<br />
按着我的填一下<br />
图26<br />
&nbsp;&nbsp;<span id="att_4302"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062548Tja.png" alt="" border="0" width="700" /></span></p>
<p>填完后 Submit<br />
图27<br />
&nbsp;&nbsp;<span id="att_4303"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0625497ti.png" alt="" border="0" width="700" /></span></p>
<p>Download 你会得到一个 DevProvision.mobileprovision 的文件，这个文件是要装到手机里面的</p>
<p>将这个拖动到organizer&nbsp;&nbsp;里面<br />
图28<br />
&nbsp;&nbsp;<span id="att_4304"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0625499Vq.png" alt="" border="0" width="700" /></span></p>
<p>拖动后如图29<br />
&nbsp;&nbsp;<span id="att_4305"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062550aIN.png" alt="" border="0" /></span></p>
<p>这时打开你的IPOD 你会发现在&nbsp;&nbsp;设置-&gt;通用-&gt;描述文件&nbsp;&nbsp;里面有个东西，那就是你的证书了<br />
然后再双击DevProvision.mobileprovision这个文件，然后你的xcode 就被激活，这时查看C盘<br />
Users用户名LibraryMobileDeviceProvisioning Profiles下面 是不是有了一个<br />
XXXXXX-XXXXXX-XXXXX-XXXXXX.mobileprovision的文件？</p>
<p>下面随便打开一个IPHONE的工程<br />
打开那个工程的plist文件，把Bundle identifier改成如下<br />
图30<br />
&nbsp;&nbsp;<span id="att_4306"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062550N92.png" alt="" border="0" /></span></p>
<p>现在大概你知道 abc 是什么东西了吧<br />
打开这个工程的info<br />
图31<br />
&nbsp;&nbsp;<span id="att_4307"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062550l1T.png" alt="" border="0" /></span></p>
<p>然后按着下图改一下设置（切记选中你该选中的那一项）<br />
图32<br />
&nbsp;&nbsp;<span id="att_4308"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062554r0x.png" alt="" border="0" width="700" /></span></p>
<p>如果你想选中的那一项是灰色的，那么你前面的某些流程一定出了问题</p>
<p>然后还有一处需要确认，如下（图33）<br />
&nbsp;&nbsp;<span id="att_4309"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0625559n9.png" alt="" border="0" /></span></p>
<p>请确认，红色是部分是你应该选中的<br />
图34<br />
&nbsp;&nbsp;<span id="att_4310"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062555kQl.png" alt="" border="0" width="700" /></span></p>
<p>OK<br />
现在已经大功告成了 99.9999%了<br />
选中Device&#8230;&nbsp;&nbsp;Debug&nbsp;&nbsp;&nbsp;&nbsp;然后 Build and Go<br />
图35<br />
&nbsp;&nbsp;<span id="att_4311"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062555prd.png" alt="" border="0" width="700" /></span></p>
<p>程序肯定已经跑在你的机器上了，如果不行，那么重起一下你的IPOD，如果再不行那就重起一下你的电脑，如果再再不行那就自己想办法吧</p>
<p>续<br />
接着如何发布程序<br />
打开Certificicates 的Distribution页面<br />
（图36）<br />
&nbsp;&nbsp;<span id="att_4330"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062556hiK.png" alt="" border="0" width="700" /></span></p>
<p>点击 Request Certificate按钮(有上面联机调试的步骤这个过程一定很熟了吧)<br />
（图37）<br />
&nbsp;&nbsp;<span id="att_4331"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062556KfB.png" alt="" border="0" width="700" /></span></p>
<p>选中CertificateSigningRequest.certSigningRequest&nbsp;&nbsp;文件(这个文件在联机调试的过程中已经生成过了)，<br />
图38<br />
&nbsp;&nbsp;<span id="att_4332"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/06255659Y.png" alt="" border="0" width="700" /></span></p>
<p>选中然后点击Submit<br />
图39<br />
&nbsp;&nbsp;<span id="att_4333"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062557Wa1.png" alt="" border="0" width="700" /></span></p>
<p>点击Appove<br />
图40<br />
&nbsp;&nbsp;<span id="att_4334"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062558wUc.png" alt="" border="0" width="700" /></span></p>
<p>这时需要刷新一下页面<br />
图41<br />
&nbsp;&nbsp;<span id="att_4335"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062558YL9.png" alt="" border="0" width="700" /></span></p>
<p>点击DownLoad<br />
会得到一个名为distribution_identity.cer 的文件<br />
双击这个文件，会有如下提示<br />
图42<br />
&nbsp;&nbsp;<span id="att_4336"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062559Jec.png" alt="" border="0" /></span></p>
<p>点击OK<br />
然后打开keychain 就会看到如下的图<br />
图43<br />
&nbsp;&nbsp;<span id="att_4337"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062559y9v.png" alt="" border="0" width="700" /></span></p>
<p>这时你的电脑就已经具备发布程序的证书了</p>
<p>下面打开Provisioning 的Distribution页面<br />
图44<br />
&nbsp;&nbsp;<span id="att_4338"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062559iSI.png" alt="" border="0" width="700" /></span><br />
点击New Profile<br />
然后按着下图填一下，Profile Name 随便写个名字就行了<br />
图45<br />
&nbsp;&nbsp;<span id="att_4339"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062600P9f.png" alt="" border="0" width="700" /></span></p>
<p>然后Submit<br />
图46<br />
&nbsp;&nbsp;<span id="att_4340"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062600zwq.png" alt="" border="0" width="700" /></span></p>
<p>刷新一下<br />
图47<br />
&nbsp;&nbsp;<span id="att_4341"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062600yCz.png" alt="" border="0" width="700" /></span></p>
<p>OK现在Download ，你会得到一个 Distribution.mobileprovision 的文件<br />
双击这个文件，你的xcode 会被激活<br />
查看C盘<br />
Users用户名LibraryMobileDeviceProvisioning Profiles下面 又多了一个<br />
XXXXXX-XXXXXX-XXXXX-XXXXXX.mobileprovision的文件</p>
<p>现在我们再配置一下xcode<br />
图48<br />
&nbsp;&nbsp;<span id="att_4342"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062601zx4.png" alt="" border="0" /></span></p>
<p>打开Configurations 页面<br />
选中Release 然后Duplicate 一下<br />
图49<br />
&nbsp;&nbsp;<span id="att_4343"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062601nUK.png" alt="" border="0" width="700" /></span></p>
<p>Duplicate之后如下图<br />
图50<br />
&nbsp;&nbsp;<span id="att_4344"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062602F8o.png" alt="" border="0" width="700" /></span></p>
<p>我们把名字改成Distribution<br />
图51<br />
&nbsp;&nbsp;<span id="att_4345"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062602Svd.png" alt="" border="0" width="700" /></span></p>
<p>接着我们切换到Build 页面<br />
图52<br />
&nbsp;&nbsp;<span id="att_4346"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0626036xW.png" alt="" border="0" width="700" /></span><br />
图中1处选中Distribution&nbsp;&nbsp; 2处选中Distribution<br />
然后<br />
图53<br />
&nbsp;&nbsp;<span id="att_4347"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/06260354g.png" alt="" border="0" /></span></p>
<p>图54<br />
&nbsp;&nbsp;<span id="att_4348"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/0626031my.png" alt="" border="0" width="700" /></span><br />
确定图54中，是你应该选的，不然build时会出现签名错误</p>
<p>确定之后，继续<br />
图55<br />
&nbsp;&nbsp;<span id="att_4349"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062604gTd.png" alt="" border="0" /></span></p>
<p>选中Device 和 Distribution<br />
OK<br />
图56<br />
&nbsp;&nbsp;<span id="att_4350"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062605xGY.png" alt="" border="0" /></span></p>
<p>Build&nbsp;&nbsp;OK&nbsp;&nbsp;大功告成了99.9%了</p>
<p>这时如果有签名错误，那一定是你上面某个地方出了问题</p>
<p>成功后<br />
图57<br />
&nbsp;&nbsp;<span id="att_4351"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062605EKE.png" alt="" border="0" width="700" /></span><br />
其中的iHide 就是我们要上传的东西，在上传之前，我们要把他压缩成 zip 包</p>
<p>现在我们在浏览器中输入<br />
itunesconnect.apple.com<br />
登录一下<br />
图58<br />
&nbsp;&nbsp;<span id="att_4352"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062605HOv.png" alt="" border="0" width="700" /></span></p>
<p>进入Manage Your Applications<br />
图59<br />
&nbsp;&nbsp;<span id="att_4353"><strong></strong><br />
<img src="http://www.wangchao123.com/wp-content/uploads/auto_save_image/2010/06/062606aYT.png" alt="" border="0" /></span><br />
点击Add New Application<br />
&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>OK了<br />
后面的不说了~~~</p>
<p>工具下载见原帖地址 <a href="http://www.cocoachina.com/bbs/read.php?tid-7923.html">http://www.cocoachina.com/bbs/read.php?tid-7923.html</a></p>
</div>
<img src ="http://www.blogjava.net/sealyu/aggbug/338774.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-23 12:45 <a href="http://www.blogjava.net/sealyu/archive/2010/11/23/338774.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to Add iAd Banner in iPhone App</title><link>http://www.blogjava.net/sealyu/archive/2010/11/20/338569.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Sat, 20 Nov 2010 14:58:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/20/338569.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338569.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/20/338569.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338569.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338569.html</trackback:ping><description><![CDATA[<p>In April 2010 during iOS 4 presentation Steve Jobs&nbsp;announced <strong>new advertisement platform &#8211; </strong><strong>iAd</strong><strong>.</strong> This platform is intended to allow developers of <strong>free apps</strong> to earn on their apps showing advertisement. The main idea of iAd is to connect <strong>interactivity</strong> (using smartphone or tablet) <strong>and emotionality</strong> of advertisement (JavaScript, HTML5, CSS3,&nbsp;multi-touch). It allows to create absolutely <strong>awesome advertisement</strong>
which looks like apps with video and audio. In addition, iAd ads is
opened inside the app and user do not exit his app and can get back
anytime he wants.</p>
<p>Below is the guide on <strong>how to add iAd banner into iPhone app.</strong> Guide is based on iAd Programming Guide and WWDC 2010 video.</p>
<h2>Add iAd Banner to iPhone App</h2>
<p>The first thing you need to do is to add <strong><em>iAd.framework</em></strong> in your <em>Xcode</em> project which is contained in <em>iOS 4 SDK</em>. Also do not forget to add <strong><em>#import &lt;iAd/iAD.h&gt;</em></strong>. Developers can choose between two banners: <em><strong>320&#215;50</strong> px for portrait</em> and <em><strong>480&#215;32</strong> px for landscape</em>. The base of banner is <strong><em>ADBannerView</em></strong>, which is subclass of <strong><em>UIView</em></strong>.
So the only thing you have to do is to add this view in your control
elements&nbsp;hierarchy (you can do this programmatically or using Interface
Builder).</p>
<p><a href="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625112541.png"><img class="alignnone size-full wp-image-423" title="iOS 4 SDK Interface Builder" src="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625112541.png" alt="iOS 4 SDK Interface Builder" width="600" height="375" /></a></p>
<p>Apple recommends to put banner at the bottom or at the top of the window and <strong>do not place it on</strong> any moving elements like <strong><em>ScrollView</em></strong> or <strong><em>TableView</em></strong>
as far as that will decrease shows of banner (and your revenue
respectively) and will make it more difficult for user to tap on the
ads.</p>
<p>Let&#8217;s create a new project in <em>Xcode</em> using View-based Application template and add a banner into it. Name of the app &#8211; <strong>iAdEx</strong>. We are going to edit <strong><em>iAdExViewController.h</em></strong></p>
<div>
<div id="highlighter_898572" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            <div class="line number6 index5 alt1">6</div>
            <div class="line number7 index6 alt2">7</div>
            <div class="line number8 index7 alt1">8</div>
            <div class="line number9 index8 alt2">9</div>
            <div class="line number10 index9 alt1">10</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc preprocessor">#import &lt;UIKit/UIKit.h&gt;;</code></div>
            <div class="line number2 index1 alt1"><code class="objc preprocessor">#import &lt;iAd/iAd.h&gt;;</code></div>
            <div class="line number3 index2 alt2">&nbsp;</div>
            <div class="line number4 index3 alt1"><code class="objc keyword">@interface</code> <code class="objc plain">iAdExViewController : UIViewController &lt;ADBannerViewDelegate&gt;</code></div>
            <div class="line number5 index4 alt2"><code class="objc plain">{</code></div>
            <div class="line number6 index5 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">ADBannerView *adView;</code></div>
            <div class="line number7 index6 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc datatypes">BOOL</code> <code class="objc plain">bannerIsVisible;</code></div>
            <div class="line number8 index7 alt1"><code class="objc plain">}</code></div>
            <div class="line number9 index8 alt2"><code class="objc keyword">@property</code> <code class="objc plain">(</code><code class="objc keyword">nonatomic</code><code class="objc plain">,assign) </code><code class="objc datatypes">BOOL</code> <code class="objc plain">bannerIsVisible;</code></div>
            <div class="line number10 index9 alt1"><code class="objc keyword">@end</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>and modify <strong><em>viewDidLoad</em></strong> method in <strong><em>iAdExViewController.m</em></strong></p>
<div>
<div id="highlighter_215469" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            <div class="line number6 index5 alt1">6</div>
            <div class="line number7 index6 alt2">7</div>
            <div class="line number8 index7 alt1">8</div>
            <div class="line number9 index8 alt2">9</div>
            <div class="line number10 index9 alt1">10</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)viewDidLoad {</code></div>
            <div class="line number2 index1 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">adView = [[ADBannerView alloc] initWithFrame:CGRectZero];</code></div>
            <div class="line number3 index2 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">adView.frame = CGRectOffset(adView.frame, 0, -50);</code></div>
            <div class="line number4 index3 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">adView.requiredContentSizeIdentifiers = [</code><code class="objc keyword">NSSet</code> <code class="objc plain">setWithObject:ADBannerContentSizeIdentifier320x50];</code></div>
            <div class="line number5 index4 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;</code></div>
            <div class="line number6 index5 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">[</code><code class="objc keyword">self</code><code class="objc plain">.view addSubview:adView];</code></div>
            <div class="line number7 index6 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">adView.delegate=</code><code class="objc keyword">self</code><code class="objc plain">;</code></div>
            <div class="line number8 index7 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc keyword">self</code><code class="objc plain">.bannerIsVisible=</code><code class="objc keyword">NO</code><code class="objc plain">;</code></div>
            <div class="line number9 index8 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">[</code><code class="objc keyword">super</code> <code class="objc plain">viewDidLoad];</code></div>
            <div class="line number10 index9 alt1"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>Let&#8217;s talk about <em><strong>requiredContentSizeIdentifiers</strong></em> and <em><strong>currentContentSizeIdentifier</strong></em><em> </em>properties.
In the first one you define all types of banners you are going to use.
And the second property defines which type of banner you are going to
use at the present moment.</p>
<h2>Connection issues</h2>
<p>Banners are downloaded from the network. What if we have no network
connection right now? Or Apple has any issues with ads server? Our <strong><em>ADBannerView</em></strong> <strong>will be empty</strong> is these cases. It doesn&#8217;t look very nice and wastes space on the screen. <strong>Apple recommends</strong>
to do it in this way: when there is no banner for any reason remove it
from the screen; when banner is received &#8211; show it again.</p>
<p>We have the <strong><em>ADBannerViewDelegate</em></strong> in our class and it can receive messages from banner &#8211; <strong><em>bannerViewDidLoadAd</em></strong> (when banner is loaded successfully) and <strong><em>didFailToReceiveAdWithError</em></strong> (when any problems occured). Let&#8217;s implement these messages:</p>
<div>
<div id="highlighter_909856" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            <div class="line number6 index5 alt1">6</div>
            <div class="line number7 index6 alt2">7</div>
            <div class="line number8 index7 alt1">8</div>
            <div class="line number9 index8 alt2">9</div>
            <div class="line number10 index9 alt1">10</div>
            <div class="line number11 index10 alt2">11</div>
            <div class="line number12 index11 alt1">12</div>
            <div class="line number13 index12 alt2">13</div>
            <div class="line number14 index13 alt1">14</div>
            <div class="line number15 index14 alt2">15</div>
            <div class="line number16 index15 alt1">16</div>
            <div class="line number17 index16 alt2">17</div>
            <div class="line number18 index17 alt1">18</div>
            <div class="line number19 index18 alt2">19</div>
            <div class="line number20 index19 alt1">20</div>
            <div class="line number21 index20 alt2">21</div>
            <div class="line number22 index21 alt1">22</div>
            <div class="line number23 index22 alt2">23</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)bannerViewDidLoadAd:(ADBannerView *)banner</code></div>
            <div class="line number2 index1 alt1"><code class="objc plain">{</code></div>
            <div class="line number3 index2 alt2"><code class="objc spaces">&nbsp;</code><code class="objc keyword">if</code> <code class="objc plain">(!</code><code class="objc keyword">self</code><code class="objc plain">.bannerIsVisible)</code></div>
            <div class="line number4 index3 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">{</code></div>
            <div class="line number5 index4 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">[UIView beginAnimations:</code><code class="objc string">@"animateAdBannerOn"</code> <code class="objc plain">context:</code><code class="objc keyword">NULL</code><code class="objc plain">];</code></div>
            <div class="line number6 index5 alt1"><code class="objc comment">// banner is invisible now and moved out of the screen on 50 px</code></div>
            <div class="line number7 index6 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">banner.frame = CGRectOffset(banner.frame, 0, 50);</code></div>
            <div class="line number8 index7 alt1"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">[UIView commitAnimations];</code></div>
            <div class="line number9 index8 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc keyword">self</code><code class="objc plain">.bannerIsVisible = </code><code class="objc keyword">YES</code><code class="objc plain">;</code></div>
            <div class="line number10 index9 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">}</code></div>
            <div class="line number11 index10 alt2"><code class="objc plain">}</code></div>
            <div class="line number12 index11 alt1">&nbsp;</div>
            <div class="line number13 index12 alt2"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(</code><code class="objc keyword">NSError</code> <code class="objc plain">*)error</code></div>
            <div class="line number14 index13 alt1"><code class="objc plain">{</code></div>
            <div class="line number15 index14 alt2"><code class="objc keyword">if</code> <code class="objc plain">(</code><code class="objc keyword">self</code><code class="objc plain">.bannerIsVisible)</code></div>
            <div class="line number16 index15 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">{</code></div>
            <div class="line number17 index16 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">[UIView beginAnimations:</code><code class="objc string">@"animateAdBannerOff"</code> <code class="objc plain">context:</code><code class="objc keyword">NULL</code><code class="objc plain">];</code></div>
            <div class="line number18 index17 alt1"><code class="objc comment">// banner is visible and we move it out of the screen, due to connection issue</code></div>
            <div class="line number19 index18 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">banner.frame = CGRectOffset(banner.frame, 0, -50);</code></div>
            <div class="line number20 index19 alt1"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">[UIView commitAnimations];</code></div>
            <div class="line number21 index20 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc keyword">self</code><code class="objc plain">.bannerIsVisible = </code><code class="objc keyword">NO</code><code class="objc plain">;</code></div>
            <div class="line number22 index21 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">}</code></div>
            <div class="line number23 index22 alt2"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>It&#8217;s time to launch the app and see what we have now:</p>
<p><a href="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135633.png"><img class="alignnone size-full wp-image-430" title="iAd banner on iPhone" src="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135633.png" alt="iAd banner on iPhone" width="334" height="453" /></a></p>
<p>Tap the banner</p>
<p><a href="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135705.png"><img class="alignnone size-full wp-image-429" title="iAd Detailed View" src="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135705.png" alt="iAd Detailed View on iPhone Simulator" width="332" height="453" /></a></p>
<p>And that&#8217;s it &#8211; <strong>we&#8217;ve done it</strong> in accordance with
Apple&#8217;s recommendations. When we launch the app we see the banner. If we
tap it, then full view of advertisement is shown. But we still have one
issue&#8230;</p>
<h2>Stop &amp; Resume your app</h2>
<p>In real app we should stop any application&#8217;s activity such as <strong>video</strong>, <strong>audio</strong> playback or pause <strong>game.</strong> In order to solve this task we will create two methods <strong><em>bannerViewActionShouldBegin</em></strong> (when full screen ad is shown) and <strong><em>bannerViewActionDidFinish</em></strong> (when we close ads).</p>
<div>
<div id="highlighter_493067" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            <div class="line number6 index5 alt1">6</div>
            <div class="line number7 index6 alt2">7</div>
            <div class="line number8 index7 alt1">8</div>
            <div class="line number9 index8 alt2">9</div>
            <div class="line number10 index9 alt1">10</div>
            <div class="line number11 index10 alt2">11</div>
            <div class="line number12 index11 alt1">12</div>
            <div class="line number13 index12 alt2">13</div>
            <div class="line number14 index13 alt1">14</div>
            <div class="line number15 index14 alt2">15</div>
            <div class="line number16 index15 alt1">16</div>
            <div class="line number17 index16 alt2">17</div>
            <div class="line number18 index17 alt1">18</div>
            <div class="line number19 index18 alt2">19</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">BOOL</code><code class="objc plain">)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(</code><code class="objc datatypes">BOOL</code><code class="objc plain">)willLeave</code></div>
            <div class="line number2 index1 alt1"><code class="objc plain">{</code></div>
            <div class="line number3 index2 alt2"><code class="objc spaces">&nbsp;</code><code class="objc keyword">NSLog</code><code class="objc plain">(</code><code class="objc string">@"Banner view is beginning an ad action"</code><code class="objc plain">);</code></div>
            <div class="line number4 index3 alt1"><code class="objc spaces">&nbsp;</code><code class="objc datatypes">BOOL</code> <code class="objc plain">shouldExecuteAction = </code><code class="objc keyword">YES</code><code class="objc plain">;</code></div>
            <div class="line number5 index4 alt2"><code class="objc spaces">&nbsp;</code><code class="objc keyword">if</code> <code class="objc plain">(!willLeave &amp;&amp; shouldExecuteAction)</code></div>
            <div class="line number6 index5 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">{</code></div>
            <div class="line number7 index6 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// stop all interactive processes in the app</code></div>
            <div class="line number8 index7 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// [video pause];</code></div>
            <div class="line number9 index8 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// [audio pause];</code></div>
            <div class="line number10 index9 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="objc plain">}</code></div>
            <div class="line number11 index10 alt2"><code class="objc spaces">&nbsp;</code><code class="objc keyword">return</code> <code class="objc plain">shouldExecuteAction;</code></div>
            <div class="line number12 index11 alt1"><code class="objc plain">}</code></div>
            <div class="line number13 index12 alt2">&nbsp;</div>
            <div class="line number14 index13 alt1"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)bannerViewActionDidFinish:(ADBannerView *)banner</code></div>
            <div class="line number15 index14 alt2"><code class="objc plain">{</code></div>
            <div class="line number16 index15 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// resume everything you've stopped</code></div>
            <div class="line number17 index16 alt2"><code class="objc spaces">&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// [video resume];</code></div>
            <div class="line number18 index17 alt1"><code class="objc spaces">&nbsp;&nbsp;&nbsp;</code><code class="objc comment">// [audio resume];</code></div>
            <div class="line number19 index18 alt2"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<h2>Change Orientation of iAd</h2>
<p>What else should we do? We need to make banner change it&#8217;s orientation <strong>in accordance with iPhone position.</strong> First of all we need to change the line where we define types of banners which we will use:</p>
<div>
<div id="highlighter_776739" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)viewDidLoad {</code></div>
            <div class="line number2 index1 alt1"><code class="objc plain">...</code></div>
            <div class="line number3 index2 alt2"><code class="objc plain">adView.requiredContentSizeIdentifiers = [</code><code class="objc keyword">NSSet</code> <code class="objc plain">setWithObjects:ADBannerContentSizeIdentifier320x50,ADBannerContentSizeIdentifier480x32,</code><code class="objc keyword">nil</code><code class="objc plain">];</code></div>
            <div class="line number4 index3 alt1"><code class="objc plain">...</code></div>
            <div class="line number5 index4 alt2"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>and here are <strong>methods for changing orientation:</strong></p>
<div>
<div id="highlighter_17584" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            <div class="line number6 index5 alt1">6</div>
            <div class="line number7 index6 alt2">7</div>
            <div class="line number8 index7 alt1">8</div>
            <div class="line number9 index8 alt2">9</div>
            <div class="line number10 index9 alt1">10</div>
            <div class="line number11 index10 alt2">11</div>
            <div class="line number12 index11 alt1">12</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">BOOL</code><code class="objc plain">)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {</code></div>
            <div class="line number2 index1 alt1"><code class="objc spaces">&nbsp;</code><code class="objc comment">// Return YES for supported orientations</code></div>
            <div class="line number3 index2 alt2"><code class="objc spaces">&nbsp;</code><code class="objc keyword">return</code> <code class="objc plain">(interfaceOrientation == UIInterfaceOrientationPortrait|UIInterfaceOrientationPortrait);</code></div>
            <div class="line number4 index3 alt1"><code class="objc plain">}</code></div>
            <div class="line number5 index4 alt2">&nbsp;</div>
            <div class="line number6 index5 alt1"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(</code><code class="objc keyword">NSTimeInterval</code><code class="objc plain">)duration</code></div>
            <div class="line number7 index6 alt2"><code class="objc plain">{</code></div>
            <div class="line number8 index7 alt1"><code class="objc spaces">&nbsp;</code><code class="objc keyword">if</code> <code class="objc plain">(UIInterfaceOrientationIsLandscape(toInterfaceOrientation))</code></div>
            <div class="line number9 index8 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32;</code></div>
            <div class="line number10 index9 alt1"><code class="objc spaces">&nbsp;</code><code class="objc keyword">else</code></div>
            <div class="line number11 index10 alt2"><code class="objc spaces">&nbsp;&nbsp;</code><code class="objc plain">adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;</code></div>
            <div class="line number12 index11 alt1"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>And here is how it look in a landscape</p>
<p><a href="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135647.png"><img class="alignnone size-full wp-image-431" title="iAd banner in landscape mode" src="http://bees4honey.com/blog/wp-content/uploads/2010/06/20100625135647.png" alt="iAd banner in landscape mode" width="578" height="406" /></a></p>
<p>When device changes orientation we change <strong><em>currentContentSizeIdentifier</em></strong> property of <strong><em>ADBannerView</em></strong>. Now we can see banners in landscape mode too. There is still 50 px offset, but it&#8217;s easy to fix.</p>
<p>Apple developers also recommend to write <strong><em>object.delegate=nil;</em></strong> line before deallocating <strong><em>ADBannerView</em></strong> object. In our example it will look like:</p>
<div>
<div id="highlighter_498812" class="syntaxhighlighter  objc">
<div class="toolbar"><span><a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/#" class="toolbar_item command_help help">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="gutter">
            <div class="line number1 index0 alt2">1</div>
            <div class="line number2 index1 alt1">2</div>
            <div class="line number3 index2 alt2">3</div>
            <div class="line number4 index3 alt1">4</div>
            <div class="line number5 index4 alt2">5</div>
            </td>
            <td class="code">
            <div class="container">
            <div class="line number1 index0 alt2"><code class="objc plain">- (</code><code class="objc datatypes">void</code><code class="objc plain">)dealloc {</code></div>
            <div class="line number2 index1 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">adView.delegate=</code><code class="objc keyword">nil</code><code class="objc plain">;</code></div>
            <div class="line number3 index2 alt2"><code class="objc spaces">&nbsp;</code><code class="objc plain">[adView release];</code></div>
            <div class="line number4 index3 alt1"><code class="objc spaces">&nbsp;</code><code class="objc plain">[</code><code class="objc keyword">super</code> <code class="objc plain">dealloc];</code></div>
            <div class="line number5 index4 alt2"><code class="objc plain">}</code></div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
<p>Now we have finished with programming part. <strong>Good luck with Apple iAd!</strong></p>
<img src ="http://www.blogjava.net/sealyu/aggbug/338569.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-20 22:58 <a href="http://www.blogjava.net/sealyu/archive/2010/11/20/338569.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cydia commCenter 补丁更新问题的解决方法</title><link>http://www.blogjava.net/sealyu/archive/2010/11/19/338492.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 19 Nov 2010 09:10:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/19/338492.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338492.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/19/338492.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338492.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338492.html</trackback:ping><description><![CDATA[Sealyu&nbsp; 2010-11-19<br />
<br />
系统 iphoneOS4.1, Cydia<br />
<br />
最近更新Cydia的时候总是出错，在更新Commcenter补丁的时候说要先卸载bspatch，但是在安装bsdiff的时候，bsdiff里也包含bspatch，所以在队列安装的时候没法满足依赖关系，导致Cydia卡在那里。<br />
<br />
在用终端（Terminal）使用root账户进入iphone文件系统后，发现跟Ubuntu等类Debian系统差不多，同样安装软件可以适用dpkg和apt-get。<br />
所以参考Ubuntu下安装软件的解决方法，终于解决了这个困扰了几天的问题。<br />
<br />
解决方法如下：<br />
1. 打开终端（Terminal）, loading完后，输入su，回车。<br />
2. 输入密码，默认为：alpine<br />
3. 输入：dpkg -i --force-overwrite /var/cache/apt/archives/XXX 。（其中的XXX为提示说无法覆盖的那个bsdiff_4.3-1xxxxx.deb那个文件）回车<br />
4. 输入： apt-get upgrade, 回车。<br />
4. 重启iphone<br />
5. 进入Cydia查看更新，搞定<br />
<br />
<img src ="http://www.blogjava.net/sealyu/aggbug/338492.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-19 17:10 <a href="http://www.blogjava.net/sealyu/archive/2010/11/19/338492.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dpkg error: trying to overwrite X, which is also in package Y</title><link>http://www.blogjava.net/sealyu/archive/2010/11/18/338428.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Thu, 18 Nov 2010 14:06:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/18/338428.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338428.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/18/338428.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338428.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338428.html</trackback:ping><description><![CDATA[<p>今天ubuntu9.10 alpha4 升级出现了点问题：</p>
<pre><span style="color: #0000ff;">Preparing to replace language-pack-zh 1:9.10 (using .../language-pack-zh_1%3a9.10+20090805_all.deb) ...<br />
Unpacking replacement language-pack-zh ...<br />
Preparing to replace language-pack-zh-base 1:9.10 (using .../language-pack-zh-base_1%3a9.10+20090805_all.deb) ...<br />
Unpacking replacement language-pack-zh-base ...<br />
dpkg: error processing /var/cache/apt/archives/language-pack-zh-base_1%3a9.10+20090805_all.deb (--unpack):<br />
trying to overwrite `/usr/share/locale-langpack/zh_TW/LC_MESSAGES/sed.mo', which is also in package language-pack-zh-hant-base<br />
dpkg-deb: subprocess paste killed by signal (Broken pipe)<br />
Preparing to replace language-pack-gnome-zh 1:9.10 (using .../language-pack-gnome-zh_1%3a9.10+20090805_all.deb) ...<br />
Unpacking replacement language-pack-gnome-zh ...<br />
Preparing to replace language-pack-gnome-zh-base 1:9.10 (using .../language-pack-gnome-zh-base_1%3a9.10+20090805_all.deb) ...<br />
Unpacking replacement language-pack-gnome-zh-base ...<br />
dpkg: error processing /var/cache/apt/archives/language-pack-gnome-zh-base_1%3a9.10+20090805_all.deb (--unpack):<br />
trying to overwrite `/usr/share/locale-langpack/zh_TW/LC_MESSAGES/gnome-settings-daemon.mo', which is also in package language-pack-gnome-zh-hant-base<br />
</span></pre>
<p>中文的显示是这样：</p>
<pre><span style="color: #0000ff;">(正在读取数据库 ... 系统当前总共安装有 123909 个文件和目录。)<br />
正在解压缩 language-pack-gnome-zh-hans-base (从 .../language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb) ...<br />
dpkg：处理 /var/cache/apt/archives/language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb (--unpack)时出错：<br />
正试图覆盖&#8220;/usr/share/locale-langpack/zh_CN/LC_MESSAGES/gnome-settings-daemon.mo&#8221;，它属于软件包 language-pack-gnome-zh-base<br />
dpkg-deb: 子进程 粘贴 被信号(Broken pipe)终止了<br />
正在解压缩 language-pack-gnome-zh-hant-base (从 .../language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb) ...<br />
dpkg：处理 /var/cache/apt/archives/language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb (--unpack)时出错：<br />
正试图覆盖&#8220;/usr/share/locale-langpack/zh_TW/LC_MESSAGES/gnome-settings-daemon.mo&#8221;，它属于软件包 language-pack-gnome-zh-base<br />
dpkg-deb: 子进程 粘贴 被信号(Broken pipe)终止了<br />
在处理时有错误发生：<br />
/var/cache/apt/archives/language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb<br />
/var/cache/apt/archives/language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb<br />
E: Sub-process /usr/bin/dpkg returned an error code (1)</span></pre>
<p>类似这样的错误：</p>
<p>dpkg: error processing /var/cache/apt/archives/<span style="color: #0000ff;">AAA</span> (&#8211;unpack):<br />
trying to overwrite `/usr/lib/<span style="color: #0000ff;">BBB</span>&#8216;, which is also in package <span style="color: #0000ff;">CCC</span><br />
dpkg-deb: subprocess paste killed by signal (Broken pipe)<br />
Errors were encountered while processing:<br />
<span style="color: #0000ff;">AAA</span><br />
E: Sub-process /usr/bin/dpkg returned an error code (1)<br />
解决方法：</p>
<p>sudo dpkg -i <span style="color: #0000ff;">--force-overwrite</span> AAA</p>
<p>(give full path of AAA), and then run</p>
<p>sudo apt-get -f install</p>
<p>again.</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/338428.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-18 22:06 <a href="http://www.blogjava.net/sealyu/archive/2010/11/18/338428.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决CYDIA提示wrong language code zh-Hans错误的解决方法</title><link>http://www.blogjava.net/sealyu/archive/2010/11/18/338422.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Thu, 18 Nov 2010 12:25:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/18/338422.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338422.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/18/338422.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338422.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338422.html</trackback:ping><description><![CDATA[<strong><font size="5">1，用(ifile, winscp)<span href="http://www.1818.tv/tag.php?name=%C8%ED%BC%FE" onclick="tagshow(event)" class="t_tag">软件</span>打开并进入/private/etc/apt目录 <br />
2，重命名<span href="http://www.1818.tv/tag.php?name=%CE%C4%BC%FE" onclick="tagshow(event)" class="t_tag">文件</span>夹sources.list.d，随便你叫什么名字，或者传到硬盘备份。 <br />
3，新建一个文件夹叫sources.list.d，权限775 <br />
4，打开<span href="http://www.1818.tv/tag.php?name=cydia" onclick="tagshow(event)" class="t_tag">cydia</span>，你会发现package里已安装文件都出现了，不过source里的源都没有了，不过无任何报错了 <br />
5，关闭cydia，重新软件回前面的文件夹，把自己建的sources.list.d给删了，把前面改名的文件夹改回来，权限改为775 <br />
<br />
<font color="#ff0066">7, 删除 /private/var/lib/cydia/metadata.plist 和 /private/etc/apt/sources.list.d/cydia.list</font></font></strong> <br />
<font color="#ff0066"><font size="5"><strong>8，重新添加你喜欢的源</strong></font></font> <br />
<br />
以下是我常用的 <br />
<br />
<strong><font size="5">deb <font color="#0070af">http://www.sinfuliphonerepo.com/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://repo.beyouriphone.com/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://www.iphone.org.hk/apt/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://wap.ucweb.com/iphone/cydia/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://app.weiphone.com/cydia/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://cydia.xsellize.com/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://iphonevideorecorder.com/3/</font></font></strong><strong><font size="5"> ./ <br />
deb <font color="#0070af">http://cydia.hackulo.us/</font> ./ <br />
deb <font color="#0070af">http://cydia.clezz.com/ </font>./ <br />
deb <font color="#0070af">http://cydis.pushfix.info/ </font>./ <br />
deb <font color="#0070af">http://iphone..com/cydia/ </font>./</font></strong> <br />
<br />
<font size="5"><strong>9，至此今后打开Cydia将不会再出现wrong language code zh-Hans&nbsp;&nbsp;了。 </strong></font>
<img src ="http://www.blogjava.net/sealyu/aggbug/338422.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-18 20:25 <a href="http://www.blogjava.net/sealyu/archive/2010/11/18/338422.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Custom action on Back Button UINavigationController</title><link>http://www.blogjava.net/sealyu/archive/2010/11/13/338008.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Sat, 13 Nov 2010 15:12:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/13/338008.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338008.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/13/338008.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338008.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338008.html</trackback:ping><description><![CDATA[<p>Yes! There is a way of using the backBarButton with a custom action.
No, it&#8217;s not by overriding the backBarButton property of navigationItem.
This is not an ugly solution with images that simulate the
&#8220;Back&#8221;-button (arrow-shaped.) It&#8217;s possible to use the backBarButton for
popping the current viewController as normal, but than with other
animations such as UIViewAnimationTransitionCurlDown.</p>
<p>Enough said, the solution is simple. You have to subclass your
navigationController&#8217;s &nbsp;popViewControllerAnimated:(BOOL)animated. So
create a custom navigationController:</p>
<h3>customNavigationController.h</h3>
<div class="wp_syntax">
<div class="code">
<pre class="objc" style="font-family: monospace;"><span style="color: #6e371a;">#import</span><br />
<span style="color: #a61390;">@interface</span> customNavigationController <span style="color: #002200;">:</span> UINavigationController <span style="color: #002200;">{</span><span style="color: #002200;">}</span><br />
<span style="color: #a61390;">@end</span></pre>
</div>
</div>
<p>And a custom &#8220;popViewControllerAnimated:(BOOL)animated&#8221;, this
popViewControllerAnimated-function uses the
&#8220;UIViewAnimationTransitionCurlDown&#8221; when popping from a
SettingsTableView.</p>
<h3>customNavigationController.m</h3>
<div class="wp_syntax">
<div class="code">
<pre class="objc" style="font-family: monospace;"><span style="color: #6e371a;">#import "customNavigationController.h"</span><br />
<span style="color: #6e371a;">#import "SettingsTableController.h"</span><br />
&nbsp;<br />
<span style="color: #a61390;">@implementation</span> customNavigationController<br />
&nbsp;<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">(</span>UIViewController <span style="color: #002200;">*</span><span style="color: #002200;">)</span>popViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #002200;">(</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">)</span>animated<br />
<span style="color: #002200;">{</span><br />
<span style="color: #a61390;">if</span><span style="color: #002200;">(</span><span style="color: #002200;">[</span><span style="color: #002200;">[</span>self.viewControllers lastObject<span style="color: #002200;">]</span> class<span style="color: #002200;">]</span> <span style="color: #002200;">==</span> <span style="color: #002200;">[</span>SettingsTableController class<span style="color: #002200;">]</span><span style="color: #002200;">)</span><span style="color: #002200;">{</span><br />
&nbsp;<br />
<span style="color: #002200;">[</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">]</span>;<br />
<span style="color: #002200;">[</span>UIView setAnimationDuration<span style="color: #002200;">:</span> <span style="color: #2400d9;">1.00</span><span style="color: #002200;">]</span>;<br />
<span style="color: #002200;">[</span>UIView setAnimationTransition<span style="color: #002200;">:</span>UIViewAnimationTransitionCurlDown<br />
forView<span style="color: #002200;">:</span>self.view cache<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">]</span>;<br />
&nbsp;<br />
UIViewController <span style="color: #002200;">*</span>viewController <span style="color: #002200;">=</span> <span style="color: #002200;">[</span>super popViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">]</span>;<br />
&nbsp;<br />
<span style="color: #002200;">[</span>UIView commitAnimations<span style="color: #002200;">]</span>;<br />
&nbsp;<br />
<span style="color: #a61390;">return</span> viewController;<br />
<span style="color: #002200;">}</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">{</span><br />
<span style="color: #a61390;">return</span> <span style="color: #002200;">[</span>super popViewControllerAnimated<span style="color: #002200;">:</span>animated<span style="color: #002200;">]</span>;<br />
<span style="color: #002200;">}</span><br />
<span style="color: #002200;">}</span><br />
<span style="color: #a61390;">@end</span></pre>
</div>
</div>
<p>Use your custom navigationController in your appDelegate:</p>
<div class="wp_syntax">
<div class="code">
<pre class="objc" style="font-family: monospace;">customNavigationController <span style="color: #002200;">*</span>navigationController <span style="color: #002200;">=</span><br />
<span style="color: #002200;">[</span><span style="color: #002200;">[</span>customNavigationController alloc<span style="color: #002200;">]</span> <br />
initWithRootViewController<span style="color: #002200;">:</span>rootView<span style="color: #002200;">]</span>;</pre>
</div>
</div>
<h3 id="comments"></h3>
<img src ="http://www.blogjava.net/sealyu/aggbug/338008.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-13 23:12 <a href="http://www.blogjava.net/sealyu/archive/2010/11/13/338008.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NavigationController导航栏中添加多个UIBarButtonItem(转)</title><link>http://www.blogjava.net/sealyu/archive/2010/11/13/338006.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Sat, 13 Nov 2010 14:37:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/13/338006.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/338006.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/13/338006.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/338006.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/338006.html</trackback:ping><description><![CDATA[<div class="excerpt">
在实际的开发中，导航器是最重要的容器之一，我们经常要在导航栏中添加各种样式的按钮，添加一个按钮很简单，代码如下图：
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTi
</div>
<p>在实际的开发中，导航器是最重要的容器之一，我们经常要在导航栏中添加各种样式的按钮，添加一个按钮很简单，代码如下图：</p>
<blockquote>
<p>UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UITabBarSystemItemContacts     <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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target:self action:@selector(clickSettings:)];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
self.navigationItem.rightBarButtonItem = anotherButton;      <br />
[anotherButton release];</p>
</blockquote>
<p>其中按钮的样式可以有多种，具体的可以参考：<a href="https://developer.apple.com/library/ios/prerelease/#documentation/UIKit/Reference/UIBarButtonItem_Class/" title="https://developer.apple.com/library/ios/prerelease/#documentation/UIKit/Reference/UIBarButtonItem_Class/">https://developer.apple.com/library/ios/prerelease/#documentation/UIKit/Reference/UIBarButtonItem_Class/</a></p>
<p>在有些项目中要在右面添加两个按钮，实现的样式如下图：</p>
<p>&nbsp;<img src="http://www.blogjava.net/images/blogjava_net/sealyu/8_101020162420_1.png" alt="" border="0" /><br />
</p>
<p>&nbsp;</p>
<p>实现的代码如下图：</p>
<blockquote>
<p>UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 150, 45)];     <br />
[tools setTintColor:[self.navigationController.navigationBar tintColor]];      <br />
[tools setAlpha:[self.navigationController.navigationBar alpha]];      <br />
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];</p>
<p>UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd      <br />
&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 action:@selector(clickSettings:)];</p>
<p>UIBarButtonItem *anotherButton1 = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UITabBarSystemItemContacts     <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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target:self action:@selector(clickEdit:)];      <br />
[buttons addObject:anotherButton];      <br />
[anotherButton release];      <br />
[buttons addObject:anotherButton1];      <br />
[anotherButton1 release];      <br />
[tools setItems:buttons animated:NO];      <br />
[buttons release];      <br />
UIBarButtonItem *myBtn = [[UIBarButtonItem alloc] initWithCustomView:tools];      <br />
self.navigationItem.rightBarButtonItem = myBtn;</p>
<p>[myBtn release];     <br />
[tools release];</p>
</blockquote>
<img src ="http://www.blogjava.net/sealyu/aggbug/338006.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-13 22:37 <a href="http://www.blogjava.net/sealyu/archive/2010/11/13/338006.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>文件操作 － Objective C 2.0（转）</title><link>http://www.blogjava.net/sealyu/archive/2010/11/12/337952.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 12 Nov 2010 13:32:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/12/337952.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/337952.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/12/337952.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/337952.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/337952.html</trackback:ping><description><![CDATA[NSFileManager can:
<div>Create a new file</div>
<div>Read from an exiting file</div>
<div>Write da<wbr>ta to file</div>
<div>Rename a file</div>
<div>Remove (delete a file)</div>
<div>Test for the existence of a file</div>
<div>Determine the size of a file as well as other attributes</div>
<div>Make a copy of a file</div>
<div>Test two files to see whether their contents are equal</div>
<div><br />
</div>
<div><span style="white-space: pre;"> </span>这些操作都可以被在directories下执行。例如你创建一个目录，读出其中元素或者删除。另一个特色是link files。也就是，一个相同的文件存在在两个不同的名字下，或许甚至是不同的目录下。</div>
<div><br />
</div>
<div><span style="white-space: pre;"> </span>为了打开一个文件并执行多次读写操作，你用NSFileHandle提供的方法。主要：</div>
<div><span style="white-space: pre;"> </span>Open a file or reading, writing , or updating (reading and writing)</div>
<div><span style="white-space: pre;"> </span>Seek to a specified position within a file</div>
<div><span style="white-space: pre;"> </span>Read or write a specified number of bytes from and to a file.</div>
<div><span style="white-space: pre;"> </span>这个类提供的方法也可以被应用在Device 或者 socket上。</div>
<div><br />
</div>
<div><span style="font-size: large;">管理文件和目录：NSFileManager</span></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; 一个文件或者目录被通过pathname 唯一的定义给NSFileManager。 一个pathname就是一个NSString类型对象能被相关联或者是全部的pathname。</div>
<div><span style="white-space: pre;"> </span>一
个相关联的pathname是关联到当前目录的那个pathname 。 所以文件名字copy1.m
将意味着这个文件在当前的目录。&#8220;／&#8221;（Slash） 实际上是根目录。／users／somone 是一个pathname 指定3个目录 ／
根目录，users目录和someone目录。</div>
<div><span style="white-space: pre;"> </span>～被用来缩写一个用户的主目录比如～linda ＝ ／users ／ linda。 在UNIX类型的pathname里面 &#8220; ." 就是当前目录". . "就是父目录（上一级）</div>
<div><br />
</div>
<div><br />
</div>
<div>NSData:</div>
<div>用这个类来处理文件的时候，你常常需要读出一个临时区域中的变量，通常叫做buffer（缓冲区）。NSData类提供一个简单的方式建立缓冲区，读出里面文件的内容，或者写一个buffer中的内容到一个文件。</div>
<div>你可以定义可变的或者不可变的存储空间。</div>
<div><br />
</div>
<img src ="http://www.blogjava.net/sealyu/aggbug/337952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-12 21:32 <a href="http://www.blogjava.net/sealyu/archive/2010/11/12/337952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iPhone开发之全局变量的使用(转)</title><link>http://www.blogjava.net/sealyu/archive/2010/11/12/337944.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 12 Nov 2010 12:57:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/12/337944.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/337944.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/12/337944.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/337944.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/337944.html</trackback:ping><description><![CDATA[<p>全局变量历来就是很好的东西，能够在开发中带来很多方便，下面来介绍一下iPhone中软件开发时全局变量的使用方法：</p>
<p>一、新建Constants.h文件（文件名根据需要自己取），用于存放全局变量；</p>
<p>二、在Constants.h中写入你需要的全局变量名，例如：</p>
<div class="codeText">
<div class="codeHead">Object-C代码</div>
<ol class="dp-cpp" start="1">
    <li class="alt"><span><span>NSString&nbsp;*master_url;//指针类型</span></span></li>
    <li class="alt"><span><span>int count;//非指针类型<br />
    </span></span></li>
</ol>
</div>
<p>注意：在定义全局变量的时候不能初始化，否则会报错！</p>
<p>三、在需要用到全局变量的文件中引入此文件：</p>
<div class="codeText">
<div class="codeHead">Object-C代码</div>
<ol class="dp-cpp" start="1">
    <li class="alt"><span><span class="preprocessor">#import&nbsp;"Constants.h"</span><span>&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<p>四、给全局变量初始化或者赋值：</p>
<div class="codeText">
<div class="codeHead">Object-C代码</div>
<ol class="dp-cpp" start="1">
    <li class="alt"><span><span class="keyword">extern</span><span>&nbsp;NSString&nbsp;*master_url;&nbsp;&nbsp;</span></span></li>
    <li class=""><span>master_url&nbsp;= [[NSString alloc] initWithFormat:@<span class="string">"http://www.wuleilei.com"</span>]<span>;</span></span><span><span>//指针类型；需要alloc</span></span></li>
    <li class=""><span><span class="keyword">extern</span><span> int count;</span></span></li>
    <li class=""><span><span>count = 0;</span></span><span><span>//非指针类型</span></span></li>
</ol>
</div>
<p>五、使用全局变量：和使用普通变量一样使用。</p>
<p><br />
</p>
<p>转自：http://www.wuleilei.com/Blog/193<br />
</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/337944.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-12 20:57 <a href="http://www.blogjava.net/sealyu/archive/2010/11/12/337944.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Mac程序开发基础：得到一个目录内的内容(转)</title><link>http://www.blogjava.net/sealyu/archive/2010/11/12/337907.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 12 Nov 2010 06:27:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/12/337907.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/337907.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/12/337907.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/337907.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/337907.html</trackback:ping><description><![CDATA[<div>
前面写了 Mac开发基础：打开一个目录的方法，下面继续，看看如何通过程序得到一个目录的内容。 1,
使用NSFileManager来得到这个目录的内容 NSArray * contentArray = [ [ NSFileManager
defaultManage
</div>
<p>前面写了<a href="http://www.cocoachina.com/newbie/basic/2010/0623/1741.html" target="_blank">Mac开发基础：打开一个目录的方法</a>，下面继续，看看如何通过程序得到一个目录的内容。</p>
<p>1, 使用NSFileManager来得到这个目录的内容</p>
<div>
<div>
<pre style="font-family: monospace;" class="objc"><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>contentArray <span style="color: #002200;">=</span> <span style="color: #002200;">[</span><span style="color: #002200;">[</span><span style="color: #400080;">NSFileManager</span> defaultManager<span style="color: #002200;">]</span> <br />
contentsOfDirectoryAtURL<span style="color: #002200;">:</span><span style="color: #002200;">[</span><span style="color: #002200;">[</span>oPanel URLs<span style="color: #002200;">]</span> objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">]</span> <br />
<span style="color: #11740a; font-style: italic;">//oPanel是上个帖子中的NSOpenPanel对象</span><br />
includingPropertiesForKeys<span style="color: #002200;">:</span><span style="color: #002200;">[</span><span style="color: #400080;">NSArray</span> array<span style="color: #002200;">]</span><br />
options<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span> <br />
error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">]</span>;</pre>
</div>
</div>
<div>
<div>
<pre style="font-family: monospace;" class="objc"><span style="color: #11740a; font-style: italic;">//我们得到一个Array的NSURL</span></pre>
</div>
</div>
<p>2, 简单显示这个Array中的内容</p>
<div>
<div>
<pre style="font-family: monospace;" class="objc">	<span style="color: #a61390;">for</span><span style="color: #002200;">(</span><span style="color: #a61390;">id</span> innerUrl <span style="color: #a61390;">in</span> contentArray<span style="color: #002200;">)</span><br />
<span style="color: #002200;">{</span><br />
NSLog<span style="color: #002200;">(</span><span style="color: #002200;">[</span>innerUrl absoluteString<span style="color: #002200;">]</span><span style="color: #002200;">)</span>;<br />
<span style="color: #002200;">}</span></pre>
</div>
</div>
<p>3, 结果</p>
<p>run<br />
[Switching to process 3626]<br />
Running&#8230;<br />
2010-06-17 23:32:43.409 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0001.xml<br />
2010-06-17 23:32:43.411 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0002.xml<br />
2010-06-17 23:32:43.411 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0003.xml<br />
2010-06-17 23:32:43.411 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0004.xml<br />
2010-06-17 23:32:43.411 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0005.xml<br />
2010-06-17 23:32:43.411 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0006.xml<br />
2010-06-17 23:32:43.412 XML2HTML[3626:a0f]  file://localhost/Users/kingmtn/Downloads/T01/T01n0007.xml</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/337907.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-12 14:27 <a href="http://www.blogjava.net/sealyu/archive/2010/11/12/337907.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>苏州破解华为HG522无线猫，使用iphone4上网</title><link>http://www.blogjava.net/sealyu/archive/2010/11/05/337383.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 05 Nov 2010 13:59:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/11/05/337383.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/337383.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/11/05/337383.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/337383.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/337383.html</trackback:ping><description><![CDATA[<img src="http://bbs.meizu.com/attachments/month_0907/20090731_0b071b0e70538ded2eeedw6Xc0TAOhqR.jpg" onload="attachimg(this, 'load')" onmouseover="attachimginfo(this, 'attach_396018', 1);attachimg(this, 'mouseover')" onclick="zoom(this, 'attachments/month_0907/20090731_0b071b0e70538ded2eeedw6Xc0TAOhqR.jpg')" onmouseout="attachimginfo(this, 'attach_396018', 0, event)" alt="" border="0" /><br />
<br />
苏州我的e家用户，将图中VPC/VCI改为8/35，这样用iphone输入wifi密码后就可以直接上网了<br />
<br />
<img src ="http://www.blogjava.net/sealyu/aggbug/337383.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-11-05 21:59 <a href="http://www.blogjava.net/sealyu/archive/2010/11/05/337383.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AwakeFromNib</title><link>http://www.blogjava.net/sealyu/archive/2010/10/28/336358.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Thu, 28 Oct 2010 02:58:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/28/336358.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/336358.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/28/336358.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/336358.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/336358.html</trackback:ping><description><![CDATA[When a nib is loaded, the nib loader allocates and initializes all
objects, then hooks up all of their outlets and actions. Because of the
order in which this happens, you cannot access outlets in your
initializer. You can try, but they will all be nil.
<p>
After all outlets and actions are connected, the nib loader sends <code>awakeFromNib</code> to every object in the nib. This is where you can access outlets to set up default values or do configuration in code. Example:
</p>
<blockquote>
<pre>- (void)awakeFromNib<br />
{<br />
[buttonOutlet setPeriodicDelay:2 interval:0.5];<br />
[textFieldOutlet setStringValue:@"Hello world!"];<br />
}</pre>
</blockquote>
<img src ="http://www.blogjava.net/sealyu/aggbug/336358.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-28 10:58 <a href="http://www.blogjava.net/sealyu/archive/2010/10/28/336358.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iphone 的cydia源</title><link>http://www.blogjava.net/sealyu/archive/2010/10/18/335414.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Mon, 18 Oct 2010 02:01:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/18/335414.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/335414.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/18/335414.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/335414.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/335414.html</trackback:ping><description><![CDATA[<span style="color: #ff0000;"><strong>下面几个是我自己的所有ios机器上越狱必定会添加的Cydia源，资源丰富，当然最重要的是免费 </strong></span><strong><br />
<a href="http://cydia.hackulo.us/" target="_blank">http://cydia.hackulo.us/</a>&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;&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;
大名鼎鼎的Hackulo源,资源不多，但都几乎是必须的,我的appsync，Installous等一般就在这里面进行安装 <br />
<a href="http://app.weiphone.com/cydia/" target="_blank">http://app.weiphone.com/cydia/</a>&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; weiphone官方的Cydia源，更新很快，资源非常多 <br />
<a href="http://apt.178.com/" target="_blank"><strong><font size="6">http://apt.178.com/</font></strong></a><strong>&nbsp;<span style="color: #ff0000;"> (重磅推荐)</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong> <br />
<strong>app破解帝<span style="color: #ff0000;">丛林狼(@Conglinlang) </span><span style="color: #000000;">的Cydia源,诠释最到位的中文Cydia源资源丰富且全部免费,,,更新快，速度快</span> </strong><br />
<br />
<a href="http://cydia.xsellize.com/" target="_blank">http://cydia.xsellize.com/</a>&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;&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; 国外知名破解软件源，资源丰富，且免费(其中破解了很多bigboos中的收费项目) <br />
<a href="http://www.sinfuliphonerepo.com/" target="_blank">http://www.sinfuliphonerepo.com</a>&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 国外知名破解软件源，资源丰富，且免费(其中破解了很多bigboos中的收费项目) <br />
<a href="http://cy.sosiphone.com/" target="_blank">http://cy.sosiphone.com/</a>&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 国外知名破解软件源，资源丰富，且免费(其中破解了很多bigboos中的收费项目) <br />
<a href="http://iphone.t/" target="_blank">http://iphone.t gbus.com/cydia/</a>&nbsp;(去掉t和g中间的空格)&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 电玩扒屎的Cydia源，资源丰富，免费项目多 <br />
<br />
<br />
<strong><span style="color: #ff0000;">以下几个为Cydia的自带源，大家需要特别注意千万别删除了(万一不小心删除的话，可以在weiphone源中找到weiphone新源，安装对应镜像源即可)：</span></strong> <br />
<a href="http://apt.modmyi.com/" target="_blank">http://apt.modmyi.com/</a>&nbsp; <br />
<a href="http://apt.bigboss.us.com/repofiles/cydia/" target="_blank">http://apt.bigboss.us.com/repofiles/cydia/</a>&nbsp; <br />
<a href="http://apt.saurik.com/" target="_blank">http://apt.saurik.com/</a>&nbsp; <br />
<a href="http://ispaziorepository.com/" target="_blank">http://ispaziorepository.com</a>&nbsp; <br />
<a href="http://repo.smxy.org/cydia/apt/" target="_blank">http://repo.smxy.org/cydia/apt/</a>&nbsp; <br />
<a href="http://www.zodttd.com/repo/cydia/" target="_blank">http://www.zodttd.com/repo/cydia/</a> </strong>
<img src ="http://www.blogjava.net/sealyu/aggbug/335414.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-18 10:01 <a href="http://www.blogjava.net/sealyu/archive/2010/10/18/335414.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Limera1n iOS 4.1&amp;3.2.2越狱教程（转）</title><link>http://www.blogjava.net/sealyu/archive/2010/10/11/334474.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Mon, 11 Oct 2010 12:37:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/11/334474.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/334474.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/11/334474.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/334474.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/334474.html</trackback:ping><description><![CDATA[神奇小子Geohot的Limera1n<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>工具现在正式放出了。此次的Limera1n<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>将对应<a href="http://iphone.weiphone.com/">iPhone</a>/iPod touch/iPad三款系列设备，可<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>的iOS包括4.1以及3.2.2。另外即使是3.0或者3.1的固件，也可以通过Limera1n进行4.1的<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>。下面是Limera1n的<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>教程及必须注意的事项，之后如Limera1n进行更新，也将会进行教程的更新。
<p>　　<strong><font size="3"><font color="#ff0000">使用本<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>工具前请注意！本工具只提供<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>而不提供解锁，有锁版<a href="http://iphone.weiphone.com/">iPhone</a>用户请勿使用，以免造成不良的后果。而目前最新版的Limera1n 为Beta4，主要更新支持MC型号的<a href="http://iphone.weiphone.com/">iPhone</a> 3GS（新Bootrom），修复自身卸载及其他一些BUG。另外目前Limera1n暂时不支持iPod touch 2代的<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>，需要等Geohot测试更新后才能支持。另外目前Limera1n仅支持</font><font color="#ff0000">Windows平台，</font><font color="#ff0000">Mac、Linux或者其他平台的Limera1n需要等待更新才能支持。</font></font></strong></p>
<p>　　<strong>下面是Limera1n<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>教程：</strong></p>
<p>下载Limera1n Beta3，进入<a href="http://limera1n.com/" target="_blank"><font color="#0070af" size="4">http://limera1n.com/</font></a><span id="att_1265623">，<strong><font color="#0000ff">如无法进入，请借助工具或者避开浏览高峰期进入。</font></strong></span></p>
<p>　　获得Limera1n，接着将<a href="http://iphone.weiphone.com/">iPhone</a>/iPod touch/iPad连接到电脑，然后打开Limera1n，见下图：</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101418050.jpg"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101418050.jpg" border="0" /></a></p>
<p>　　接着点击make in ra1n，然后会出现下面这个界面，提示&#8220;hold home+power&#8221;</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101419140.jpg"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101419140.jpg" border="0" /></a></p>
<p>　　按照提示按住<strong><font size="3">电源键+home键</font></strong>不要松手，等待一会，将出现新的提示：&#8220;Relase power button&#8221;</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101421260.jpg"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101421260.jpg" border="0" /></a></p>
<p align="left">　　这个时候按照<font size="2"><strong>提示松开电源键，但是home键请保持继续按住的状态</strong></font>，然后将会显示&#8220;in DFU mode...wait&#8221;，进入了DFU模式，见下图：</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101422530.jpg"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101422530.jpg" border="0" /></a></p>
<p align="left">　　这个时候<a href="http://iphone.weiphone.com/">iPhone</a>/iPod touch/iPad的屏幕上将会出现Limera1n的标志——一滴绿色的雨滴。接着请耐心等待一会，成功的话将会出现以下的界面：</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101425070.jpg"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101425070.jpg" border="0" /></a></p>
<p align="left">　　Limera1n<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>第一部分完成。接着重启设备，然后在屏幕内找到Limera1n的图标点击进入。</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101427580.png"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101427580.png" border="0" /></a></p>
<p align="left">　　在Limera1n里面选择cydia，然后再点击右上角的&#8220;Install&#8221;，开始进行cydia的下载。注意！此步骤需要无线网络支持。</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101427330.png"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101427330.png" border="0" /></a></p>
<p align="left">　　国外用户可直接下载，国内用户如无法下载的，请设置设备内的VPN。</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101429230.png"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101429230.png" border="0" /></a></p>
<p align="left">　　cydia下载完成，本次Limera1n<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>工作完成。</p>
<p align="center"><a title="Limera1n iOS 4.1&amp;3.2.2越狱教程" href="http://resource.weiphone.com/resource/h003/h44/img201010101437470.png"><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101437470.png" border="0" /></a></p>
<p align="left">　　<strong><font color="#ff0000"><a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>时及完成<a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>后的注意事项：</font></strong></p>
<p align="left"><strong><font color="#ff0000">　　1 <a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>的时候请打开iTunes！</font></strong></p>
<p align="left"><strong><font color="#ff0000">　　2 <a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>完成后请通过</font><font color="#ff0000">cydia进行SHSH的备份。未备份SHSH的用户，在Cydia的首页会有一个红心标志，点击即可备份。如已经备份过的，则不会出现此标志，并且会在Cydia首页最上方显示&#8220;SHSH:iOS 4.1&#8221;，表示此设备已经备份过SHSH。</font></strong></p>
<p align="left"><strong><font color="#ff0000">　　3 <a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>后如果limera1n和Cydia图标是白色的，无需紧张，重启设备即可。</font></strong></p>
<p align="left"><font color="#ff0000"><strong>　　4 <a href="http://www.weiphone.com/newbie/iPhone/terminology/2009-08-31/What_is_the_escape_JailBreak__205530.shtml">越狱</a>后的ipa破解补丁安装，请进入</strong></font></p>
<p align="left"><font color="#ff0000">　　<a href="http://apt.weiphone.com/cydia"><strong>http://apt.weiphone.com/cydia</strong></a></font></p>
<p align="left"><font color="#ff0000">　　<a href="http://app.weiphone.com/cydia/"><strong>http://app.weiphone.com/cydia/</strong></a></font></p>
<p align="left"><font color="#ff0000">　　<a href="http://apt.weiphone.com/cydia/saurik"><strong>http://apt.weiphone.com/cydia/saurik</strong></a></font></p>
<p align="left"><font color="#ff0000">　　<a href="http://apt.weiphone.com/cydia/bigboss"><strong>http://apt.weiphone.com/cydia/bigboss</strong></a></font></p>
<p align="left"><font color="#ff0000">　　<a href="http://cydia.hackulo.us/"><strong>http://cydia.hackulo.us</strong></a></font></p>
<p align="left"><font color="#ff0000"><strong>　　等源，下载安装相应的ipa破解补丁。</strong></font></p>
<img src ="http://www.blogjava.net/sealyu/aggbug/334474.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-11 20:37 <a href="http://www.blogjava.net/sealyu/archive/2010/10/11/334474.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH</title><link>http://www.blogjava.net/sealyu/archive/2010/10/11/334472.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Mon, 11 Oct 2010 12:14:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/11/334472.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/334472.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/11/334472.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/334472.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/334472.html</trackback:ping><description><![CDATA[苹果已经准备好发布4.1固件更新，有很多有锁越狱用户没有升级但是想备份一下4.1的SHSH以便今后越狱，所以备份
SHSH仍然是王道——备份4.1固件对应SHSH后可以任意由其它版本固件恢复到4.1固件。下一页中将说明TinyUmbrella无法识别已连接电
脑的设备的SHSH备份方法。
<p align="left">　　ECID SHSH备份工具TinyUmbrella即原来的Firmware
Umbrella，是一款用来申请ECID配对的SHSH文件的软件，支持未越狱的设备。最新版4.1.4支持iOS
4.1和iPhone4。此程序需要Java运行环境支持，如果没有安装，请到<a title="Java官方网站" href="http://www.java.com/" target="_blank">Java官方网站</a>下载安装。</p>
<p align="center"><img onmousewheel="return bbimg(this)" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913464468.jpg" onload="resizepic(this)" width="500" border="0" height="395"  alt="" /></p>
<p align="center"><a title="TinyUmbrella" href="http://iphone.tgbus.com/software/new3soft/hcak3/201009/20100911093344.shtml" target="_blank">TinyUmbrella 4.1.4下载</a></p>
<p align="center"><a title="iTunes10下载" href="http://iphone.tgbus.com/software/applesoft/201009/20100902095321.shtml" target="_blank">iTunes10下载</a></p>
<p align="center"><a title="Java官方网站" href="http://www.java.com/" target="_blank">Java运行环境下载</a></p>
<hr />
<p align="left"><strong><font color="#ff0000">注意事项：</font></strong></p>
<p align="left">　　1.使用TinyUmbrella之前，请卸载电脑上的Wi-Fi Sync（如果以前安装过）。</p>
<p align="left">　　2.使用本地SHSH恢复过程中可能会有错误提示弹出，但不用担心，固件的确可以完成恢复，如果卡在DFU或黑屏模式无法退出，则可以使用集成的<strong>Kick Device Out of Recovery（如下图）</strong>按钮来退出恢复模式。</p>
<p align="left">　　3.Mac用户请将App拷备出DMG镜像再运行，否则会收到无尽的密码提示选项。</p>
<p align="left">　　4.必须安装iTunes9.0或以上版本，推荐iTunes10。</p>
<hr />
<p align="left">　　<strong>软件的操作非常简单：</strong></p>
<p align="left">一、备份shsh</p>
<p align="left">　　先将iPhone联机，点击<strong>Save My SHSH</strong>开始备份。<br />
SHSH文件的位置位于：<br />
Windows XP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C:"Documents and Settings"用户名".shsh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Windows　　　7 C:"Users"用户名".shsh"&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; <br />
Mac　　　　　/Users/用户名/.shsh/&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;</p>
<p align="left">注意：<br />
1，在Mac下面文件夹.shsh是隐藏的，要想显示，需在终端中输入：defaults
write com.apple.finder AppleShowAllFiles -bool
true命令后重启Finder；恢复隐藏，则将true改为false，重启finder。</p>
<p align="left">　　2，从Apple和Saurik取回的SHSH大小不同，但是在恢复时没有影响。</p>
<p align="left">二、自建服务器恢复固件</p>
<p align="left">　　在第一步完成之后，<br />
无需更改hosts，<br />
点击右上角<strong>Start TSS Servicer</strong>后恢复SHSH对应固件即可。</p>
<hr />
<p align="left">几点说明：</p>
<p align="left">　　1.<strong>Save My SHSH</strong>按钮就是备份SHSH的开关。连接iDevice到电脑后，打开TinyUmbrella后直接点击此按钮即可备份SHSH。</p>
<p align="left">　　2.<strong>Start TSS Server</strong>按钮是在恢复固件时使用的，按下后即可使用本地的SHSH文件来恢复iPhone固件。</p>
<p align="left">　　3.<strong>Display SHSHs</strong>按钮是用来显示设备是否有相应的SHSH可以下载或者使用，效果如下：</p>
<p align="center"><img onmousewheel="return bbimg(this)" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913455005.jpg" onload="resizepic(this)" width="500" border="0" height="354"  alt="" /></p>
<p align="left">　　4.Advanced
Options勾选后会出现ECID、Device/Version和Location三个选项：第一个ECID处可以手动输入ECID码；第二
Device/Version用来强制选择型号和版本；第三个Location是选择SHSH的备份地址，这个要重点介绍一下，选择Apple是从苹果备
份、选择Cydia则是在Cydia中备份、选择Local是备份到本地。没有在本地看到SHSH文件的用户不用担心，默认的备份使用Cydia服务器。</p>
<p align="left"><br />
</p>
<p align="left">当TinyUmbrella无法识别已经连接到电脑的iPhone、iPad或者iPod touch时，就不能一键备份SHSH了，首先需要<a title="使用USBView来查看iPhone的ECID" href="http://iphone.tgbus.com/tutorial/use/201005/20100505094039.shtml" target="_blank">使用USBView来查看iPhone的ECID</a>（也可使用<a title="ECID读取器" href="http://iphone.tgbus.com/software/new3soft/hcak3/201004/20100430103101.shtml" target="_blank">ECID读取器</a>或者<a title="Auto SHSH Grabber" href="http://iphone.tgbus.com/software/new3soft/hcak3/201004/20100430105520.shtml" target="_blank">Auto SHSH Grabber</a>，选择一种习惯的方法即可，不需要每种方法都会）。这里我们使用最可靠的USBView。
</p>
<p align="center"><img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574642.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">首先，按住HOME和Power键十秒左右，iPhone屏幕黑掉，之后读五秒，保持Home键按住并松开Power，当打开的iTunes出现上图中的反映时松开所有按键。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574690.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">此时，应该有这样的提示。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574662.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">运行USBView，点击上面的Options。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574602.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">按图中选中Config Description。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574683.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">之后按F5刷新，可以看到一个处于DFU模式的iPhone。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574665.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">这时，在右侧可以找到对应的ECID和iBoot版本。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913574691.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">打开TinyUmbrella并将ECID填入Advanced Options中的ECID框内。<br />
<br />
<img onmousewheel="return bbimg(this)" src="http://iphone.tgbus.com/UploadFiles/201009/2010091914064426.jpg" onload="resizepic(this)" width="500" border="0" height="395"  alt="" /></p>
<p align="center">随后，没有越狱过的iPhone需要把Request From一项选择为Apple，然后点击Save My SHSH按键开始保存相应版本的SHSH。（越狱并备份过4.1SHSH的用户可以直接选择Cydia来保存SHSH）。<br />
<br />
<img onmousewheel="return bbimg(this)" alt="不越狱用TinyUmbrella4.1.4备份iOS4.1的SHSH" src="http://iphone.tgbus.com/UploadFiles/201009/2010091913581233.jpg" onload="resizepic(this)" border="0" hspace="0" /></p>
<p align="center">恢复固件时打开TSS Server选项，这时会自动杀掉iTunes，重新打开后即可正常恢复。</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/334472.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-11 20:14 <a href="http://www.blogjava.net/sealyu/archive/2010/10/11/334472.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Helper class for showing records with pagination for iPhone sdk app</title><link>http://www.blogjava.net/sealyu/archive/2010/10/08/334004.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 08 Oct 2010 13:30:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/08/334004.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/334004.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/08/334004.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/334004.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/334004.html</trackback:ping><description><![CDATA[<p>We often need to add social features in our iPhone apps. Adding
features like commenting, shouts etc are very common. These type of data
are usually shown<br />
with pagination with buttons like next, previous etc.</p>
<p>To reduce the overhead of creating this functionality again and again
we may encapsulate the common functions in a class. So did I for my
applications.</p>
<p>I have created a class named PaginationAgent. After loading records
it calls related methods of its delegate which should implement protocol
PaginationAgentDeleagte.</p>
<p>Additionally two php files are needed. One to return the total number
of records and another one is to fetch the page data. They must be
named respectively as</p>
<ul>
    <li> get_total_number_of_records.php</li>
    <li>get_records.php</li>
</ul>
<p>Lets see an example.</p>
<p>First, I have created a simple view based project &#8220;Pagination&#8221; and designed the view as u see:</p>
<div id="attachment_21" class="wp-caption aligncenter" style="width: 265px;"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-21.png"><img wp-image-21="" title="Interface" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-21-255x300.png" alt="" width="255" height="300" /></a>
<p>Create a similar view using Interface Builder</p>
</div>
<p>1. Added a button to show previous page data</p>
<p>2. One button to reload the data.</p>
<p>3. Another to show data on next page.</p>
<p>4. Added a UITable which will show the result.</p>
<p>In PaginationViewController.h, imported PaginationAgent.h file and declared:</p>
<div>
<ol start="1">
    <li>PaginationAgent*&nbsp;objPagination;&nbsp;&nbsp;</li>
</ol>
</div>
<pre style="display: none;" name="code" class="c++">PaginationAgent* objPagination;
</pre>
<p>Now lets see how to initialize it. In the viewDidLoad method I initialized this like this:</p>
<div>
<div>
<div><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;">view plain</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;">copy to clipboard</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;">print</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('About',this);return false;">?</a></div>
</div>
<ol start="1">
    <li>objPagination&nbsp;=&nbsp;[[PaginationAgent&nbsp;alloc]&nbsp;init];&nbsp;&nbsp;</li>
    <li>objPagination.delegate&nbsp;=&nbsp;self;&nbsp;&nbsp;</li>
    <li>objPagination.remoteApiBasePath&nbsp;=&nbsp;@"http://your.server/path/to/folder";&nbsp;&nbsp;</li>
</ol>
</div>
<pre style="display: none;" name="code" class="c++">objPagination = [[PaginationAgent alloc] init];
objPagination.delegate = self;
objPagination.remoteApiBasePath = @"http://your.server/path/to/folder";</pre>
<p>remoteApiBasePath must be set to the location where the server side php files are placed.<br />
No trailing slash.</p>
<p>PaginationAgentDelegate protocol declares the following functions to be overridden by the Delegate:</p>
<div>
<div>
<div><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;">view plain</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;">copy to clipboard</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;">print</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('About',this);return false;">?</a></div>
</div>
<ol start="1">
    <li>/**&nbsp;</li>
    <li>*&nbsp;This&nbsp;method&nbsp;is&nbsp;called&nbsp;when&nbsp;the&nbsp;busystate&nbsp;is&nbsp;changed.&nbsp;</li>
    <li>*&nbsp;You&nbsp;can&nbsp;do&nbsp;something&nbsp;like&nbsp;disable/enable&nbsp;the&nbsp;buttons,&nbsp;grayout&nbsp;etc&nbsp;</li>
    <li>*&nbsp;based&nbsp;on&nbsp;the&nbsp;isBusy&nbsp;value.&nbsp;</li>
    <li>*/&nbsp;&nbsp;</li>
    <li>-(void)paginationAgent:(PaginationAgent*)agent&nbsp;updateBusyMode:(BOOL)isBusy;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>/**&nbsp;</li>
    <li>*&nbsp;Called&nbsp;when&nbsp;total&nbsp;data&nbsp;count&nbsp;is&nbsp;received&nbsp;if&nbsp;shouldReloadAtFirstPage&nbsp;is&nbsp;set&nbsp;NO.&nbsp;</li>
    <li>*/&nbsp;&nbsp;</li>
    <li>-(void)paginationAgent:(PaginationAgent*)agent&nbsp;totalDataCountReceived:(int)dataCount;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>/**&nbsp;</li>
    <li>*&nbsp;Called&nbsp;when&nbsp;page&nbsp;data&nbsp;is&nbsp;loaded.&nbsp;You&nbsp;may&nbsp;set&nbsp;your&nbsp;table&nbsp;dataSource&nbsp;here&nbsp;and&nbsp;realod&nbsp;</li>
    <li>*&nbsp;reload&nbsp;the&nbsp;table.&nbsp;</li>
    <li>*/&nbsp;&nbsp;</li>
    <li>-(void)paginationAgent:(PaginationAgent*)agent&nbsp;pageDataReceived:(NSArray*)data;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>/**&nbsp;</li>
    <li>*&nbsp;Called&nbsp;if&nbsp;server&nbsp;sends&nbsp;malformed&nbsp;data&nbsp;</li>
    <li>*/&nbsp;&nbsp;</li>
    <li>-(void)paginationAgent:(PaginationAgent*)agent&nbsp;onPaginationServerError:(NSString*)message;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>/**&nbsp;</li>
    <li>*&nbsp;Called&nbsp;if&nbsp;connection&nbsp;failed.&nbsp;It&nbsp;may&nbsp;occur&nbsp;due&nbsp;to&nbsp;poor&nbsp;or&nbsp;no&nbsp;internet&nbsp;connectivity&nbsp;</li>
    <li>*/&nbsp;&nbsp;</li>
    <li>-(void)paginationAgent:(PaginationAgent*)agent&nbsp;onPaginationConnectionError:(NSString*)message;&nbsp;&nbsp;</li>
</ol>
</div>
<pre style="display: none;" name="code" class="c++">/**
* This method is called when the busystate is changed.
* You can do something like disable/enable the buttons, grayout etc
* based on the isBusy value.
*/
-(void)paginationAgent:(PaginationAgent*)agent updateBusyMode:(BOOL)isBusy;
/**
* Called when total data count is received if shouldReloadAtFirstPage is set NO.
*/
-(void)paginationAgent:(PaginationAgent*)agent totalDataCountReceived:(int)dataCount;
/**
* Called when page data is loaded. You may set your table dataSource here and realod
* reload the table.
*/
-(void)paginationAgent:(PaginationAgent*)agent pageDataReceived:(NSArray*)data;
/**
* Called if server sends malformed data
*/
-(void)paginationAgent:(PaginationAgent*)agent onPaginationServerError:(NSString*)message;
/**
* Called if connection failed. It may occur due to poor or no internet connectivity
*/
-(void)paginationAgent:(PaginationAgent*)agent onPaginationConnectionError:(NSString*)message;</pre>
<p>The php files must return data in json format and must use the format as used:</p>
<div>
<div>
<div><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;">view plain</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;">copy to clipboard</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;">print</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('About',this);return false;">?</a></div>
</div>
<ol start="1">
    <li>1,'message'=&gt;'Success','data'=&gt;33);&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;json_encode($data);&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>?&gt;&nbsp;&nbsp;</li>
</ol>
</div>
<pre style="display: none;" name="code" class="php">1,'message'=&gt;'Success','data'=&gt;33);
echo json_encode($data);
?&gt;
</pre>
<div>
<div>
<div><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;">view plain</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;">copy to clipboard</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;">print</a><a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#" onclick="dp.sh.Toolbar.Command('About',this);return false;">?</a></div>
</div>
<ol start="1">
    <li>...&nbsp;&nbsp;</li>
    <li>...&nbsp;&nbsp;</li>
    <li>$data&nbsp;=&nbsp;array('success'=&gt;1,'message'=&gt;'Got&nbsp;data','data'=&gt;$rows);&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>echo&nbsp;json_encode($data);&nbsp;&nbsp;</li>
</ol>
</div>
<pre style="display: none;" name="code" class="php">...
...
$data = array('success'=&gt;1,'message'=&gt;'Got data','data'=&gt;$rows);
echo json_encode($data);
</pre>
<p>See the attached project for details. The php files are inside the folder &#8220;PHPFILES&#8221;.</p>
<p><a title="Pagination xCode project with PHP files" href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Pagination.zip">Pagination.zip</a></p>
<!-- Generated by Digg Digg plugin,
Author : Yong Mook Kim
Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/ -->
<img src ="http://www.blogjava.net/sealyu/aggbug/334004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-08 21:30 <a href="http://www.blogjava.net/sealyu/archive/2010/10/08/334004.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How To Integrate iAd into Your iPhone App</title><link>http://www.blogjava.net/sealyu/archive/2010/10/08/333984.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 08 Oct 2010 08:35:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/08/333984.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333984.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/08/333984.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333984.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333984.html</trackback:ping><description><![CDATA[<h1>How To Integrate iAd into Your iPhone App</h1>
<div id="attachment_1372" class="wp-caption alignright" style="width: 265px;"><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/iadtutorial" rel="attachment wp-att-1372"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iAdTutorial.png" alt="1) Integrate iAd 2) ??? 3) PROFIT!" title="1) Integrate iAd 2) ??? 3) PROFIT!" class="size-full wp-image-1372" height="225" width="255" /></a>
<p class="wp-caption-text">1) Integrate iAd 2) ??? 3) PROFIT!</p>
</div>
<p>With the iOs SDK 4 now public and the advent of iAds just a few days
away, I thought we&#8217;d celebrate with a tutorial on how to integrate iAd
into your iPhone app!</p>
<p>In this tutorial, not only will we show you how to get started with
iAd, but we&#8217;ll also show you how to deal with some complex issues you
may run into along the way such as:</p>
<ul>
    <li>Supporting both Portrait and Landscape ads in the same app</li>
    <li>Integrating into a Universal app</li>
    <li>Maintaining backwards compatibility with iOs 3.0</li>
    <li>What to do if you are using a UITableViewController!</li>
</ul>
<p>We&#8217;re actually going to start with where we left off in the <a href="http://www.raywenderlich.com/1111/how-to-port-an-iphone-application-to-the-ipad">How To Port an iPhone Application to the iPad</a> and use the <a href="http://www.raywenderlich.com/downloads/PortMeAfter.zip">universal app</a> we developed in that tutorial in the starting point.</p>
<p>So grab a copy if you haven&#8217;t already, and let&#8217;s get to adding some iAds!</p>
<h2>Base SDK vs. Deployment Target</h2>
<p>The first step to use iAd is to make sure our project has the right Base SDK and iPhone OS Deployment Target selected.</p>
<p>For those of you confused about the difference between the Base SDK
and Deployment Target (like I was for quite some time!), here&#8217;s what
they mean:</p>
<ul>
    <li>The <em>Base SDK</em> is the version of the SDK you are linking
    against.  Your app can use any classes or functions available in the
    version of the SDK you choose here &#8211; as long as they are available on
    the actual device the code runs on.</li>
    <li>The <em>Deployment Target</em> is the earliest possible version of
    the SDK your code can run on.  This can be an earlier version than the
    Base SDK &#8211; in fact you often want to set it to be earlier to ensure that
    as many different versions of the OS can run your code as possible!</li>
</ul>
<p>The tricky bit is what happens when you want to use a class,
function, or framework available in one version of the OS if it&#8217;s
available, but still work on the old version of the OS if it isn&#8217;t.  We
already did some of this in <a href="http://www.raywenderlich.com/1111/how-to-port-an-iphone-application-to-the-ipad">How To Port an iPhone Application to the iPad</a>, and we&#8217;ll do even more in this tutorial!</p>
<p>For this tutorial, we want to set things up so that our code can use
stuff available in iOS 4.0 (such as iAd), but still run on as many
devices as reasonable (3.0+). </p>
<p>So first let&#8217;s set iOs 4.0 as the base SDK.  To do this, expand the
Targets directory, right click on PortMe, and choose &#8220;Get Info&#8221;.  Click
the Build tab, make sure &#8220;All Configurations&#8221; is selected, navigate to
Architectures\Base SDK, and change the value to iPhone Device 4.0.  </p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/basesdk4" rel="attachment wp-att-1373"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/BaseSDK4.png" alt="Screenshot of Setting Base SDK" title="Screenshot of Setting Base SDK" class="alignnone size-full wp-image-1373" height="229" width="427" /></a></p>
<p>Then, let&#8217;s set iPhone OS 3.0 as the iPhone OS Deployment Target.  To
do this, still in the Target Build tab, navigate to Deployment\iPhone
OS Deployment Target, and change the value to iPhone OS 3.0.</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/deploymenttarget-2" rel="attachment wp-att-1374"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/DeploymentTarget.png" alt="Screenshot of setting Deployment Target" title="Screenshot of setting Deployment Target" class="alignnone size-full wp-image-1374" height="244" width="495" /></a></p>
<p>You should now be able to compile and run your app (use the iPhone
simulator), and try it out on an iPhone 4 simulator.  Once you run your
code, in the simulator choose Hardware\Device\iPhone OS 4 and re-run
your app.  The simulator window will look a little different, and say
iPhone 4 in the toolbar, so you&#8217;ll know it&#8217;s working!</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/ios4simulator" rel="attachment wp-att-1375"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iOs4Simulator.png" alt="Screenshot of PortMe on iOS4" title="Screenshot of PortMe on iOS4" class="alignnone size-full wp-image-1375 bordered" height="480" width="320" /></a></p>
<h2>Linking Against the iAd Framework</h2>
<p>The next thing we need to do is add the iAd framework to the project.
You can do this by right clicking on Frameworks, choosing
&#8220;Add\Existing Frameworks&#8230;&#8221;, and choosing &#8220;iAd.framework&#8221;.</p>
<p>The problem is, if that is all we do our code will break on older devices that don&#8217;t have the iAd framework.  </p>
<p>You can verify this by trying to run your code in the iPad Simulator
3.2 &#8211; boom!  The app will crash on startup and you&#8217;ll see the following
error log:</p>
<pre class="command">dyld: Library not loaded: /System/Library/Frameworks/iAd.framework/iAd
Referenced from: /Users/rwenderlich/Library/Application Support/
iPhone Simulator/3.2/Applications/
3ACB1BDA-26F6-43A6-84EA-9FB637B8CDCD/PortMe.app/PortMe
Reason: image not found
</pre>
<p>To fix this, we need to weak link against the iAd framework.  Expand
the Targets directory, right click on PortMe, and choose &#8220;Get Info&#8221;.
Click the Build tab, make sure &#8220;All Configurations&#8221; is selected, and
navigate to Linking\Other Linker Flags.  Double click on that entry,
click the &#8220;+&#8221; button, and type &#8220;-weak_framework iAd&#8221;.  </p>
<p>Click OK, and then try your app on the iPad simulator again and viola &#8211; it should work!</p>
<h2>Preparing our XIB</h2>
<p>In this tutorial, we&#8217;re going to integrate iAd into both the
PortMeGameListController and the PortMeGameDetailsController.  However,
the integration is a bit easier in the PortMeGameDetailsController
because it is a subclass of UIViewController, so we&#8217;re going to start
there first.</p>
<p>Open up PortMeGameDetailsController.xib.  You&#8217;ll see that all of the controls are children of a single view:</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/detailsviewcontrollerbefore" rel="attachment wp-att-1376"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/DetailsViewControllerBefore.png" alt="Details View Controller Settings - Before" title="Details View Controller Settings - Before" class="alignnone size-full wp-image-1376" height="303" width="403" /></a></p>
<p>What we&#8217;re going to need to do with iAd is scroll an ad view onto the
screen when an ad is available, and shrink the rest of the content to
fill the remaining space.  As currently designed, this isn&#8217;t that easy
because all of the controls are direct children of the root view.  But
there&#8217;s an easy way to fix it &#8211; we&#8217;ll simply move the controls into a
subview instead!</p>
<p>The easiest way to do this is to drag another view from the library
into the XIB, and change its size to be the same as the existing view&#8217;s
size (320&#215;416).  Then drag the existing view as a subview of the new
view.  When you&#8217;re done, it should look like the following:</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/detailsviewcontrollerafter" rel="attachment wp-att-1377"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/DetailsViewControllerAfter.png" alt="Details View Controller Settings - After" title="Details View Controller Settings - After" class="alignnone size-full wp-image-1377" height="304" width="409" /></a></p>
<p>Then, control-drag from the File&#8217;s Owner to the new view (which is
now the root view) to connect it to the view outlet.  Save your XIB, and
run the project and verify that everything still works OK with the
details view (in particularly that orientation resizing works
correctly).  If all works well, we&#8217;re one step closer to integrating
iAd!</p>
<h2>Simple iAd Integration</h2>
<p>Ok, now let&#8217;s get to the fun part &#8211; integrating iAd!</p>
<p>First, make the following changes to PortMeGameDetailsController:</p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13711">
            <td class="code" id="p1371code1">
            <pre class="objc" style="font-family: monospace;"><span style="color: #11740a; font-style: italic;">// In the import section</span>
            <span style="color: #6e371a;">#import "iAd/ADBannerView.h"</span>
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// Modify the PortMeGameDetailsController interface</span>
            <span style="color: #a61390;">@interface</span> PortMeGameDetailsController <span style="color: #002200;">:</span> UIViewController
            &lt;GameSelectionDelegate, UISplitViewControllerDelegate, ADBannerViewDelegate&gt; <span style="color: #002200;">{</span>
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// Inside the PortMeGameDetailsController interface</span>
            UIView <span style="color: #002200;">*</span>_contentView;
            <span style="color: #a61390;">id</span> _adBannerView;
            <span style="color: #a61390;">BOOL</span> _adBannerViewIsVisible;
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// After the interface</span>
            <span style="color: #a61390;">@property</span> <span style="color: #002200;">(</span>nonatomic, retain<span style="color: #002200;">)</span> IBOutlet UIView <span style="color: #002200;">*</span>contentView;
            <span style="color: #a61390;">@property</span> <span style="color: #002200;">(</span>nonatomic, retain<span style="color: #002200;">)</span> <span style="color: #a61390;">id</span> adBannerView;
            <span style="color: #a61390;">@property</span> <span style="color: #002200;">(</span>nonatomic<span style="color: #002200;">)</span> <span style="color: #a61390;">BOOL</span> adBannerViewIsVisible;</pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>We first include the iAd headers and mark the view controller as
implementing the ADBannerViewDelegate.  This way, we can receive events
as ads become available or not.</p>
<p>We then declare a property to keep track of the content view that
contains all of the controls (basically the inner UIView).  We also
declare a variable to keep track of our iAd banner view, and whether or
not it&#8217;s currently visible.</p>
<p>Note that we declare the iAd banner view as an id variable rather
than as a ADBannerView.  This is because we want to ensure backwards
compatibility all the way to OS 3.0, and the ADBannerView class is only
available on 4.0+, so we need to weak link against it.</p>
<p>Before we forget, let&#8217;s hook up our content view to the new outlet we
just made.  Make sure you save PortMeGameDetailsController.h, go back
to PortMeGameDetailsController.xib, control-drag from the File&#8217;s Owner
to the inner (second) UIView, and connect it to the contentView outlet.</p>
<p>Then switch over to PortMeGameDetailsController.m and make the following changes:</p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13712">
            <td class="code" id="p1371code2">
            <pre class="objc" style="font-family: monospace;"><span style="color: #11740a; font-style: italic;">// In the synthesize section</span>
            <span style="color: #a61390;">@synthesize</span> contentView <span style="color: #002200;">=</span> _contentView;
            <span style="color: #a61390;">@synthesize</span> adBannerView <span style="color: #002200;">=</span> _adBannerView;
            <span style="color: #a61390;">@synthesize</span> adBannerViewIsVisible <span style="color: #002200;">=</span> _adBannerViewIsVisible;
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// In the dealloc section</span>
            self.contentView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
            self.adBannerView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;</pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>Next, we&#8217;re going to add the meat of the code.  But there&#8217;s a lot of it &#8211; so let&#8217;s break it down into 6 steps.</p>
<p><em>1) Add helper functions to get height of iAd banner</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13713">
            <td class="code" id="p1371code3">
            <pre class="objc" style="font-family: monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">int</span><span style="color: #002200;">)</span>getBannerHeight<span style="color: #002200;">:</span><span style="color: #002200;">(</span>UIDeviceOrientation<span style="color: #002200;">)</span>orientation <span style="color: #002200;">{</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>UIInterfaceOrientationIsLandscape<span style="color: #002200;">(</span>orientation<span style="color: #002200;">)</span><span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            <span style="color: #a61390;">return</span> <span style="color: #2400d9;">32</span>;
            <span style="color: #002200;">}</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">{</span>
            <span style="color: #a61390;">return</span> <span style="color: #2400d9;">50</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">}</span>
            &nbsp;
            <span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">int</span><span style="color: #002200;">)</span>getBannerHeight <span style="color: #002200;">{</span>
            <span style="color: #a61390;">return</span> <span style="color: #002200;">[</span>self getBannerHeight<span style="color: #002200;">:</span><span style="color: #002200;">[</span>UIDevice currentDevice<span style="color: #002200;">]</span>.orientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>There are several places in the rest of the code where we&#8217;re going to
want to know how large the banner view should be given a particular
orientation.  Currently iAds have two possible sizes: 320&#215;50 for
landscape, or 480&#215;32 for portrait.  So we simply retrieve the proper
height based on the passed in orientation.</p>
<p><em>2) Add helper function to create the iAd view</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13714">
            <td class="code" id="p1371code4">
            <pre class="objc" style="font-family: monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>createAdBannerView <span style="color: #002200;">{</span>
            <span style="color: #a61390;">Class</span> classAdBannerView <span style="color: #002200;">=</span> NSClassFromString<span style="color: #002200;">(</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">"ADBannerView"</span><span style="color: #002200;">)</span>;
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>classAdBannerView <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            self.adBannerView <span style="color: #002200;">=</span> <span style="color: #002200;">[</span><span style="color: #002200;">[</span><span style="color: #002200;">[</span>classAdBannerView alloc<span style="color: #002200;">]</span>
            initWithFrame<span style="color: #002200;">:</span>CGRectZero<span style="color: #002200;">]</span> autorelease<span style="color: #002200;">]</span>;
            <span style="color: #002200;">[</span>_adBannerView setRequiredContentSizeIdentifiers<span style="color: #002200;">:</span><span style="color: #002200;">[</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/"><span style="color: #400080;">NSSet</span></a> setWithObjects<span style="color: #002200;">:</span>
            ADBannerContentSizeIdentifier320x50,
            ADBannerContentSizeIdentifier480x32, <span style="color: #a61390;">nil</span><span style="color: #002200;">]</span><span style="color: #002200;">]</span>;
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>UIInterfaceOrientationIsLandscape<span style="color: #002200;">(</span><span style="color: #002200;">[</span>UIDevice currentDevice<span style="color: #002200;">]</span>.orientation<span style="color: #002200;">)</span><span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>_adBannerView setCurrentContentSizeIdentifier<span style="color: #002200;">:</span>
            ADBannerContentSizeIdentifier480x32<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>_adBannerView setCurrentContentSizeIdentifier<span style="color: #002200;">:</span>
            ADBannerContentSizeIdentifier320x50<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">[</span>_adBannerView setFrame<span style="color: #002200;">:</span>CGRectOffset<span style="color: #002200;">(</span><span style="color: #002200;">[</span>_adBannerView frame<span style="color: #002200;">]</span>, <span style="color: #2400d9;">0</span>,
            <span style="color: #002200;">-</span><span style="color: #002200;">[</span>self getBannerHeight<span style="color: #002200;">]</span><span style="color: #002200;">)</span><span style="color: #002200;">]</span>;
            <span style="color: #002200;">[</span>_adBannerView setDelegate<span style="color: #002200;">:</span>self<span style="color: #002200;">]</span>;
            &nbsp;
            <span style="color: #002200;">[</span>self.view addSubview<span style="color: #002200;">:</span>_adBannerView<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>This helper function creates an ADBannerView in a manner that is safe
to use across multiple OS versions.  It uses weak linking and
NSClassFromString to check if the ADBannerView class is available &#8211; if
it is not, the method will return nil and the function will bail.</p>
<p>However, if it is available it creates an instance of the class.  It
then uses the setRequiredContentSizeIdentifiers to specify what kind of
ads this app needs.  For our case, our app supports both portrait and
landscape modes so it needs both ad options.</p>
<p>It then calls setCurrentContentSizeIdentifier to tell iAd which ad it
should display.  We simply choose the correct one by looking at the
current orientation.</p>
<p>Next, we need to set the frame for the iAd.  Note there&#8217;s some funky
business here &#8211; we actually set the frame of the view to be offscreen!
This is because we don&#8217;t know if an ad is available yet, and we don&#8217;t
want to display the view until we know one is.</p>
<p>We set our view controller as the delegate so that we can receive
notice about iAds being available or not.  Then finally we ad the new
iAd banner view as a subview of our view!</p>
<p>Note something subtle about the above &#8211; we always use message passing
syntax rather than dot notation (i.e. [_adBannerView
setRequiredContentSizeIdentifiers:...] instead of
_adBannerView.requiredContentSizeIdentifiers = &#8230;).  This is again to
make sure everything runs fine on OS 3.0+.</p>
<p><em>3) Add function to size views correctly</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13715">
            <td class="code" id="p1371code5">
            <pre class="objc" style="font-family: monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>fixupAdView<span style="color: #002200;">:</span><span style="color: #002200;">(</span>UIInterfaceOrientation<span style="color: #002200;">)</span>toInterfaceOrientation <span style="color: #002200;">{</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>_adBannerView <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>UIInterfaceOrientationIsLandscape<span style="color: #002200;">(</span>toInterfaceOrientation<span style="color: #002200;">)</span><span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>_adBannerView setCurrentContentSizeIdentifier<span style="color: #002200;">:</span>
            ADBannerContentSizeIdentifier480x32<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>_adBannerView setCurrentContentSizeIdentifier<span style="color: #002200;">:</span>
            ADBannerContentSizeIdentifier320x50<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">[</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">"fixupViews"</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">]</span>;
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>_adBannerViewIsVisible<span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            CGRect adBannerViewFrame <span style="color: #002200;">=</span> <span style="color: #002200;">[</span>_adBannerView frame<span style="color: #002200;">]</span>;
            adBannerViewFrame.origin.x <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
            adBannerViewFrame.origin.y <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
            <span style="color: #002200;">[</span>_adBannerView setFrame<span style="color: #002200;">:</span>adBannerViewFrame<span style="color: #002200;">]</span>;
            CGRect contentViewFrame <span style="color: #002200;">=</span> _contentView.frame;
            contentViewFrame.origin.y <span style="color: #002200;">=</span>
            <span style="color: #002200;">[</span>self getBannerHeight<span style="color: #002200;">:</span>toInterfaceOrientation<span style="color: #002200;">]</span>;
            contentViewFrame.size.height <span style="color: #002200;">=</span> self.view.frame.size.height <span style="color: #002200;">-</span>
            <span style="color: #002200;">[</span>self getBannerHeight<span style="color: #002200;">:</span>toInterfaceOrientation<span style="color: #002200;">]</span>;
            _contentView.frame <span style="color: #002200;">=</span> contentViewFrame;
            <span style="color: #002200;">}</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">{</span>
            CGRect adBannerViewFrame <span style="color: #002200;">=</span> <span style="color: #002200;">[</span>_adBannerView frame<span style="color: #002200;">]</span>;
            adBannerViewFrame.origin.x <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
            adBannerViewFrame.origin.y <span style="color: #002200;">=</span>
            <span style="color: #002200;">-</span><span style="color: #002200;">[</span>self getBannerHeight<span style="color: #002200;">:</span>toInterfaceOrientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">[</span>_adBannerView setFrame<span style="color: #002200;">:</span>adBannerViewFrame<span style="color: #002200;">]</span>;
            CGRect contentViewFrame <span style="color: #002200;">=</span> _contentView.frame;
            contentViewFrame.origin.y <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
            contentViewFrame.size.height <span style="color: #002200;">=</span> self.view.frame.size.height;
            _contentView.frame <span style="color: #002200;">=</span> contentViewFrame;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">[</span>UIView commitAnimations<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>This is a helper function we can call to make sure our views are in
the right position.  If ads are available, we want the ad banner view to
be at the top of the screen and the content view shrunk a bit to fill
the rest of the area.  If ads are not available, we want the ad banner
view offscreen and the content view as large as the entire view here.</p>
<p>And that&#8217;s exactly what the above function does.  It looks long, but
is fairly simple and self-explanatory.  Note that we wrap the resizing
code in an animation block to make things look awesome.</p>
<p><em>4) Call createAdView in viewDidLoad</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13716">
            <td class="code" id="p1371code6">
            <pre class="objc" style="font-family: monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>viewDidLoad <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>self createAdBannerView<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>We want to create our ad view as soon as our view is loaded, even if we aren&#8217;t ready to display it quite yet.</p>
<p><em>5) Call fixupAdView in viewWillAppear and willRotateToInterfaceOrientation</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13717">
            <td class="code" id="p1371code7">
            <pre class="objc" style="font-family: monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span> viewWillAppear<span style="color: #002200;">:</span><span style="color: #002200;">(</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">)</span>animated <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>self refresh<span style="color: #002200;">]</span>;
            <span style="color: #002200;">[</span>self fixupAdView<span style="color: #002200;">:</span><span style="color: #002200;">[</span>UIDevice currentDevice<span style="color: #002200;">]</span>.orientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            &nbsp;
            <span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>willRotateToInterfaceOrientation<span style="color: #002200;">:</span><span style="color: #002200;">(</span>UIInterfaceOrientation<span style="color: #002200;">)</span>toInterfaceOrientation duration<span style="color: #002200;">:</span><span style="color: #002200;">(</span>NSTimeInterval<span style="color: #002200;">)</span>duration <span style="color: #002200;">{</span>
            <span style="color: #002200;">[</span>self fixupAdView<span style="color: #002200;">:</span>toInterfaceOrientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>We need to fix up our ad view in viewWillAppear, because the device
may have changed orientations in the time between when our view was
visible last and now.  And we obviously need to change it upon rotation
as well!</p>
<p><em>6) Implement ADBannerViewDelegate</em></p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13718">
            <td class="code" id="p1371code8">
            <pre class="objc" style="font-family: monospace;"><span style="color: #6e371a;">#pragma mark ADBannerViewDelegate</span>
            &nbsp;
            <span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>bannerViewDidLoadAd<span style="color: #002200;">:</span><span style="color: #002200;">(</span>ADBannerView <span style="color: #002200;">*</span><span style="color: #002200;">)</span>banner <span style="color: #002200;">{</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span><span style="color: #002200;">!</span>_adBannerViewIsVisible<span style="color: #002200;">)</span> <span style="color: #002200;">{</span>
            _adBannerViewIsVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
            <span style="color: #002200;">[</span>self fixupAdView<span style="color: #002200;">:</span><span style="color: #002200;">[</span>UIDevice currentDevice<span style="color: #002200;">]</span>.orientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">}</span>
            &nbsp;
            <span style="color: #002200;">-</span> <span style="color: #002200;">(</span><span style="color: #a61390;">void</span><span style="color: #002200;">)</span>bannerView<span style="color: #002200;">:</span><span style="color: #002200;">(</span>ADBannerView <span style="color: #002200;">*</span><span style="color: #002200;">)</span>banner didFailToReceiveAdWithError<span style="color: #002200;">:</span><span style="color: #002200;">(</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span style="color: #400080;">NSError</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">)</span>error
            <span style="color: #002200;">{</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">(</span>_adBannerViewIsVisible<span style="color: #002200;">)</span>
            <span style="color: #002200;">{</span>
            _adBannerViewIsVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
            <span style="color: #002200;">[</span>self fixupAdView<span style="color: #002200;">:</span><span style="color: #002200;">[</span>UIDevice currentDevice<span style="color: #002200;">]</span>.orientation<span style="color: #002200;">]</span>;
            <span style="color: #002200;">}</span>
            <span style="color: #002200;">}</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>Now that we have our helper functions, implementing the
ADBannerViewDelegate methods are quite simple.  We simply toggle whether
the ad banner view should be visible or not, and call fixupAdView.</p>
<p><em>Done!</em></p>
<p>And that&#8217;s it!  Compile and run your project, and you should see ads appear correctly in both portrait and landscape mode.</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/iadportrait" rel="attachment wp-att-1378"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iAdPortrait.png" alt="iAd in List View - Portrait Mode" title="iAd in List View - Portrait Mode" class="alignnone size-full wp-image-1378 bordered" height="480" width="321" /></a></p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/iadlandscape" rel="attachment wp-att-1379"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iAdLandscape.png" alt="iAd in List View - Landscape Mode" title="iAd in List View - Landscape Mode" class="alignnone size-full wp-image-1379 bordered" height="321" width="480" /></a></p>
<p>And best yet &#8211; if you run the code on an iPad or iPhone 3.0 device it will work just fine as well, but without ads!</p>
<h2>UITableView integration</h2>
<p>Well that worked great for our details controller, but we want it in our list controller too!</p>
<p>The problem is our list controller is a UITableViewController.
Unfortunately, it seems like the best way to deal with this situation is
to convert your UITableViewController to a normal UIViewController and
then proceed similarly to the way we did above.  So here are all of the
gory steps:</p>
<p><em>1) Create a XIB for PortMeGameListController</em></p>
<p>Go to File\New File, choose User Interface and View XIB, make sure
Product is iPhone, and click Next.  Name the XIB
PortMeGameListController.xib and click Finish.</p>
<p>Open up the XIB, click on the File&#8217;s Owner, and in the fourth tab of
the Attributes Inspector change the class to PortMeGameListController.</p>
<p>Then drag a UIView into the current UIView (so there are 2, just like
we did before), and add a UITableView to the inner view.  When you&#8217;re
done it should look like this:</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/listviewcontroller" rel="attachment wp-att-1380"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/ListViewController.png" alt="XIB settings for PortMe's List View Controller" title="XIB settings for PortMe's List View Controller" class="alignnone size-full wp-image-1380" height="301" width="366" /></a></p>
<p><em>2) Make some changes to PortMeGameListController</em></p>
<p>Inside PortMeGameListController.h:</p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p13719">
            <td class="code" id="p1371code9">
            <pre class="objc" style="font-family: monospace;"><span style="color: #11740a; font-style: italic;">// Change the interface declaration</span>
            <span style="color: #a61390;">@interface</span> PortMeGameListController <span style="color: #002200;">:</span> UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; <span style="color: #002200;">{</span>
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// Add inside class</span>
            UITableView <span style="color: #002200;">*</span>_tableView;
            UIView <span style="color: #002200;">*</span>_contentView;
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// Add after class</span>
            <span style="color: #a61390;">@property</span> <span style="color: #002200;">(</span>nonatomic, retain<span style="color: #002200;">)</span> IBOutlet UITableView <span style="color: #002200;">*</span>tableView;
            <span style="color: #a61390;">@property</span> <span style="color: #002200;">(</span>nonatomic, retain<span style="color: #002200;">)</span> IBOutlet UIView <span style="color: #002200;">*</span>contentView;</pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>Inside PortMeGameListController.m:</p>
<div class="wp_codebox">
<table>
    <tbody>
        <tr id="p137110">
            <td class="code" id="p1371code10">
            <pre class="objc" style="font-family: monospace;"><span style="color: #11740a; font-style: italic;">// In synthesize section</span>
            <span style="color: #a61390;">@synthesize</span> tableView <span style="color: #002200;">=</span> _tableView;
            <span style="color: #a61390;">@synthesize</span> contentView <span style="color: #002200;">=</span> _contentView;
            &nbsp;
            <span style="color: #11740a; font-style: italic;">// In dealloc section</span>
            self.tableView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
            self.contentView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;</pre>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>Don&#8217;t forget to save the files!</p>
<p><em>3) Hook up outlets</em></p>
<p>Now go back to PortMeGameListController.xib and connect the first
view to the view outlet, the second to the contentView outlet, and the
third to the tableView outlet.</p>
<p>Also control-drag from the tableView back to the File&#8217;s Owner and set it as the delegate and datasource.</p>
<p><em>4) Set the NIB name for PortMeGameListController in MainWindow</em></p>
<p>Open MainWindow.xib and MainWindow-iPad.xib, expand the Navigation
Controller, select &#8220;Port Me Game List Controller&#8221;, and change the nib
name to PortMeGameListController.</p>
<p><em>5) Compile and test to make sure everything works as usual</em></p>
<p>At this point, compile and run your code and make sure everything
works as it usually does &#8211; but now you&#8217;re using a UIViewController
rather than a TableViewController, and you have a XIB laid out in a nice
way to use iAds!</p>
<p><em>6) Follow the steps from the previous section</em></p>
<p>Now you&#8217;re exactly where we were in the previous section with a view
controller &#8211; so follow the same steps to integrate in this view!  </p>
<p><em>Done!</em></p>
<p>If all goes well, you should be able to compile and run your project and see advertisements at the top of your table view!</p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/iadportraittableview" rel="attachment wp-att-1381"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iAdPortraitTableView.png" alt="iAd in Table View - Portrait Mode" title="iAd in Table View - Portrait Mode" class="alignnone size-full wp-image-1381 bordered" height="481" width="321" /></a></p>
<p><a href="http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app/iadlandscapetableview" rel="attachment wp-att-1382"><img src="http://www.raywenderlich.com/wp-content/uploads/2010/06/iAdLandscapeTableView.png" alt="iAd in Table View - Landscape Mode" title="iAd in Table View - Landscape Mode" class="alignnone size-full wp-image-1382 bordered" height="321" width="482" /></a></p>
<h2>Where To Go Now?</h2>
<p>Here is a <a href="http://www.raywenderlich.com/downloads/PortMeWithAds.zip">sample project</a> with all of the code we&#8217;ve developed in the above tutorial.</p>
<p>Now you should know how to integrate iAds into your projects &#8211; no
matter what OSs you wish to support for your app!  I&#8217;d love to hear your
experiences with iAds and how well they are working (or not) for your
app!
</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/333984.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-08 16:35 <a href="http://www.blogjava.net/sealyu/archive/2010/10/08/333984.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iPhone设置视图背景图片的方法(转)</title><link>http://www.blogjava.net/sealyu/archive/2010/10/08/333982.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 08 Oct 2010 08:04:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/08/333982.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333982.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/08/333982.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333982.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333982.html</trackback:ping><description><![CDATA[方法一，使用一个UIImageView实例做子视图，并且放最后面
<br />
<br />
<div class="dp-highlighter">
<div class="bar">
<div class="tools">Objective-c代码 </div>
</div>
<ol class="dp-default" start="1">
    <li><span><span>-&nbsp;(void)setBackgroundImage&nbsp;{&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;NSLog(@<span class="string">"setting&nbsp;bg&nbsp;image"</span><span>);&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;UIImageView&nbsp;*customBackground&nbsp;=&nbsp;[[UIImageView&nbsp;alloc]&nbsp;initWithImage:[UIImage&nbsp;imageNamed:@<span class="string">"background.jpg"</span><span>]];&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;self.background&nbsp;=&nbsp;customBackground;&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[customBackground&nbsp;release];&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[self&nbsp;addSubview:background];&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;NSLog(@<span class="string">"Added&nbsp;background&nbsp;subview&nbsp;%@"</span><span>,&nbsp;background);&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[self&nbsp;sendSubviewToBack:background];&nbsp;&nbsp;</span></li>
    <li><span>}&nbsp;&nbsp;</span></li>
</ol>
</div>
<pre style="display: none;" name="code" class="Objective-C">- (void)setBackgroundImage {
NSLog(@"setting bg image");
UIImageView *customBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.jpg"]];
self.background = customBackground;
[customBackground release];
[self addSubview:background];
NSLog(@"Added background subview %@", background);
[self sendSubviewToBack:background];
}</pre>
<br />
<br />
方法二，Cook Book中提到的方法
<br />
<br />
<div class="dp-highlighter">
<div class="bar">
<div class="tools">Objective-c代码 </div>
</div>
<ol class="dp-default" start="1">
    <li><span><span>-&nbsp;(void)loadView&nbsp;{&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;UIImageView&nbsp;*contentView&nbsp;=&nbsp;[[UIImageView&nbsp;alloc]&nbsp;initWithFrame:[[UIScreen&nbsp;mainScreen]&nbsp;applicationFrame]];&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[contentView&nbsp;setImage:[UIImage&nbsp;imageNamed:@<span class="string">"Default.png"</span><span>]];&nbsp;&nbsp;</span></span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[contentView&nbsp;setUserInteractionEnabled:YES];&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;self.view&nbsp;=&nbsp;contentView;&nbsp;&nbsp;</span></li>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;[contentView&nbsp;release];&nbsp;&nbsp;</span></li>
    <li><span>}&nbsp;&nbsp;</span></li>
</ol>
</div>
<pre style="display: none;" name="code" class="Objective-C">- (void)loadView {
UIImageView *contentView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView setImage:[UIImage imageNamed:@"Default.png"]];
[contentView setUserInteractionEnabled:YES];
self.view = contentView;
[contentView release];
}</pre>
<br />
<br />
方法三，lvyile网友用的一个小技巧，uiView是UIView的实例，而不是UIImageView
<br />
<br />
<div class="dp-highlighter">
<div class="bar">
<div class="tools">Objective-c代码 </div>
</div>
<ol class="dp-default" start="1">
    <li><span><span>uiView.backgroundColor&nbsp;=&nbsp;[UIColor&nbsp;colorWithPatternImage:[UIImage&nbsp;imageNamed:@</span><span class="string">"Default.png"</span><span>]];&nbsp; <br />
    </span></span></li>
</ol>
</div>
<img src ="http://www.blogjava.net/sealyu/aggbug/333982.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-08 16:04 <a href="http://www.blogjava.net/sealyu/archive/2010/10/08/333982.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How To Make Ultra-Slick Gradient UITableView Cells</title><link>http://www.blogjava.net/sealyu/archive/2010/10/08/333958.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 08 Oct 2010 03:02:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/08/333958.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333958.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/08/333958.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333958.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333958.html</trackback:ping><description><![CDATA[<p><strong>Editor&#8217;s Note: </strong><em>You&#8217;ve seen the slick supercool
gradient UITableView backgrounds, and this is how to make them quick and
easy.&nbsp; Thanks to Brett Romero of Cygen for this tutorial,
ManiacDev.Com&#8217;s first submitted tutorial.&nbsp; If you&#8217;ve created a quality,
original tutorial that you think iPhone developers might want to read
about please e-mail webmaster@maniacdev.com. </em><br />
<span style="font-size: small;"><strong>- Johann Dowa, ManiacDev.Com</strong></span><br />
&nbsp;<br />
This demonstration provides an example of how to spice up your
UITableView rows for a more polished look. In addition to seeing how
easy it can be to design a nice graphic for your iPhone app, you get a
start to finish implementation. </p>
<p>This video was embedded using the YouTuber plugin by <a href="http://www.roytanck.com/">Roy Tanck</a>. Adobe Flash Player is required to view the video.<br />
The finished product is shown below.</p>
<p><img src="http://maniacdev.com/wp-content/uploads/CellBackGroundDemoScreenshot%281%29.png" alt="" height="742" width="386" /></p>
<div style="clear: both;">&nbsp;</div>
<p>Rather than sticking with stock components included in Interface
Builder, this demonstration shows a simple technique that gives your app
a more professional look. As a developer, it can be difficult to create
nice looking graphics for your app. Hiring a designer can quickly
exceed the budget. However, creating some nice looking graphics is
certainly achievable as a beginning designer. In addition to picking up
some new great skills, a polished off UI can lend more creditability to
your app and provide an overall better user experience.</p>
<p>In the demo, Photoshop Elements is used, which is 80 bucks at
adobe.com with a mail-in rebate. To get started, create a new image with
these values:</p>
<ul>
    <li>Width: 80 pixels</li>
    <li>Height: 40 pixels</li>
    <li>Background Contents: Transparent</li>
</ul>
<p>Select a foreground color from the toolbar, as shown below:</p>
<p>&nbsp;</p>
<p><img src="http://maniacdev.com/wp-content/uploads/ForeColor.png" alt="" height="157" width="171" /></p>
<div style="clear: both;">&nbsp;</div>
<p>Now select the gradient button, as shown below:</p>
<p>&nbsp;</p>
<p><img src="http://maniacdev.com/wp-content/uploads/GradientToolbarItem.png" alt="" height="157" width="171" /></p>
<div style="clear: both;">&nbsp;</div>
<p>With the gradient selected, swipe from bottom to top on your image.
This should produce a gradient color. Now choose File and &#8220;Save for
Web&#8221;. You&#8217;ve just created the image we&#8217;ll use in our tableview. Let&#8217;s
switch over to Xcode and implement the image.</p>
<p>In Xcode, we start by creating a navigation based application.</p>
<p>Once the application has been created, add the newly created image by
right clicking the Resources folder then &#8220;Add&#8221; and &#8220;Existing Files&#8221;, as
shown below:</p>
<p>&nbsp;</p>
<p><img src="http://maniacdev.com/wp-content/uploads/AddExistingFileToResourcesFolder.png" alt="" height="172" width="458" /></p>
<div style="clear: both;">&nbsp;</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The following code snippet creates two views. Both are then added to
the cell&#8217;s view. Because the label, which is a view, is added as the
last view, we need to ensure its background is transparent (clearColor).
Otherwise, it will cover part or all (depending on the size we set) of
our background image. Thinking about what this stack of layers will look
like, below is a screenshot of the same scenario in Interface Builder:</p>
<p>&nbsp;</p>
<p><img alt="" src="http://maniacdev.com/wp-content/uploads/celllayers.png" height="56" width="300" /></p>
<div style="clear: both;">&nbsp;</div>
<p>From the screenshot, you can see the cell&#8217;s view owns the imageview
and label. Although closer to the bottom, the label is actually top most
to the user, hence the reason we need its background to clear.</p>
<p>Let&#8217;s take a look at the implementation in Xcode, which is all done in the UITableView delegate method cellForRowAtIndexPath:.</p>
<pre>UIImage *image = [UIImage imageNamed:@"gradientcolor.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeScaleToFill;
cell.backgroundView = imageView;
[imageView release];
UILabel *label = [[UILabel alloc] init];
label.text = @"testing colors";
label.frame = cell.bounds;
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
[cell addSubview:label];
return cell;
</pre>
<p>In the above snippet, we create an image object using the image we
added to our app bundle. Next, we create a UIImageView object with the
newly created image. The image view will be assigned to our cell&#8217;s
background view. The backgroundView will retain an instance of the
imageView. Therefore, we release our instance, as follows:</p>
<pre>[imageView release];
</pre>
<p>If we had not released our instance, we&#8217;d have two instances of the
imageView in memory and thus a memory leak. Moving on down in the code,
we create an instance of a label. We set the label&#8217;s size to cover the
entire cell. The label&#8217;s background is set to clear or transparent so it
doesn&#8217;t hide the cell&#8217;s background image. Our assigned text is centered
and finally, we add the label to the cell&#8217;s view, making it the top
most view in the cell.</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/333958.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-08 11:02 <a href="http://www.blogjava.net/sealyu/archive/2010/10/08/333958.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Changing UITableView width</title><link>http://www.blogjava.net/sealyu/archive/2010/10/08/333955.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Fri, 08 Oct 2010 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/08/333955.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333955.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/08/333955.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333955.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333955.html</trackback:ping><description><![CDATA[<p>I&#8217;m back to programming and currently developing application for iPad. I needed something, what looked like a simplest thing &#8211; <strong>UITableView</strong> taking a portion of screen and <strong>SplitViewController</strong>
wasn&#8217;t attractive option. To my surprise non of the obvious to me
solutions worked until I&#8217;ve tried not-so-elegant reallocating of <em>tableView</em>.</p>
<p>So, in <em>myTableViewController</em> I created custom <em>init</em> function:</p>
<pre class="brush: cpp;">- (id) initWithFrame:(CGRect)frm {
if ((self = [super initWithStyle: UITableViewStylePlain])){
self.tableView = [[UITableView alloc] initWithFrame:frm style:UITableViewStylePlain];
}
return self;
}</pre>
<p>Obviously, you can use default or your own <em>init</em> function or avoid passing frame argument and hardcode dimensions right here, but the magical line is:</p>
<pre class="brush: cpp;">self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, y, width, height) style:UITableViewStylePlain];</pre>
<p>Well, at least it worked for me.</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/333955.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-08 10:40 <a href="http://www.blogjava.net/sealyu/archive/2010/10/08/333955.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iPhone Programming: Set UITableView Accessory Arrow Style</title><link>http://www.blogjava.net/sealyu/archive/2010/10/07/333915.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Thu, 07 Oct 2010 12:21:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/07/333915.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333915.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/07/333915.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333915.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333915.html</trackback:ping><description><![CDATA[<h4>The iPhone SDK provides an easy-to-code standard for creating
consistent user interfaces.  The UITableView class is used in many
iPhone applications.  Most applications that present information to you
in rows that you can tap to slide a new page over to see details use a
UITableView to do the magic.  Once you have a UITableView setup, you can
easily add the little accessory arrow icons to the right side of the
table cells by following the steps in this Tech-Recipe.</h4>
<p><br />
At this point, you need to have a working UITableView-based application.
If you aren&#8217;t at this point, you&#8217;ll need to take a few steps back and
check with the official Apple iPhone SDK documentation. </p>
<p>The simplest case is adding an accessory icon to the right of all
cells in the table.  To do this, edit the source file of the table view
you want to change and add the following method:</p>
<p><code>- (UITableViewCellAccessoryType)tableView:(UITableView *)tv accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath<br />
{<br />
&nbsp;&nbsp;&nbsp;return UITableViewCellAccessoryDetailDisclosureButton;<br />
}</code></p>
<p>Yeah, that&#8217;s a keyboard-full, but it&#8217;s not that bad. Because your
table view class is the delegate of your actual table view, implementing
this method of the UITableViewController class will automatically
affect the cells in your table. No other changes are needed to make this
work.  Very cool.</p>
<p>If you don&#8217;t want to show the accessory image for every cell in the
table, you&#8217;ll need to implement some logic in this method that takes the
NSIndexPath parameter (which tells you which row in which section is
being asked about) and responds appropriately.</p>
<p>There are three standard accessory images that can be used by this
method. Each image is shown below with the matching
UITableViewCellAccessoryType (the example uses shows a Disclosure
indicator image because it returns
UITableViewCellAccessoryDisclosureIndicator.</p>
<p><img class="left" src="http://m.tech-recipes.com/rx/UITV_accessory_disclosure.png"  alt="" /> Disclosure indicator<br />
<br />
<strong>UITableViewCellAccessoryDisclosureIndicator</strong><br />
Used to indicate that tapping the cell will slide in a new table view one level down in the hierarchy.
</p>
<hr />
<p><img class="left" src="http://m.tech-recipes.com/rx/UITV_accessory_detail.png"  alt="" /> Detail disclosure button<br />
<br />
<strong>UITableViewCellAccessoryDetailDisclosureButton</strong><br />
This button indicates that tapping the cell will reveal a detail view of that item.
</p>
<hr />
<p><img class="left" src="http://m.tech-recipes.com/rx/UITV_accessory_checkmark.png"  alt="" /> Checkmark<br />
<br />
<strong>UITableViewCellAccessoryCheckmark</strong><br />
Indicates that a row has been selected by the user.
</p>
<hr />
<p>Nothing<br />
<br />
<strong>UITableViewCellAccessoryNone</strong><br />
This is the default value for the cell accessory indicating that no accessory should be shown.
</p>
<p>This isn&#8217;t a brain surgery level Tech-Recipe and this information is,
of course, covered in the official documentation, but I keep forgetting
the method name and knew it would be easier to lookup here than in the
docs.  I hope someone else finds it helpful, too.</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/333915.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-07 20:21 <a href="http://www.blogjava.net/sealyu/archive/2010/10/07/333915.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Easy custom UITableView drawing</title><link>http://www.blogjava.net/sealyu/archive/2010/10/07/333863.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Thu, 07 Oct 2010 04:35:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/07/333863.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333863.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/07/333863.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333863.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333863.html</trackback:ping><description><![CDATA[<span class="introduction">
<p>It is really easy to customize your <code>UITableView</code>s. I'll show you how to completely customize the appearance of <code>UITableView</code>s without overriding or subclassing and without the need for any tricky hackery.</p>
</span>
<span class="fullpost">
<h4>Make my table pretty</h4>
<p>The core of most iPhone applications is the <code>UITableView</code>. To make your iPhone application stand out, the simplest way is to make your <code>UITableView</code> look good.</p>
<p>Customizing your <code>UITableView</code> can be really easy. You
don't need custom drawing code. You don't need subclasses of anything.
Cocoa Touch provides all the drawing capability you need, all you have
to do is use the right classes in the right ways and provide the layout.</p>
<h4>The sample application</h4>
<p>The approach I'll show you will turn the table on the left into the table on the right:</p>
<img src="http://lh5.ggpht.com/_gfktUGS0ov0/SfW4y9Ic6SI/AAAAAAAAASw/LXvmLTvjCQU/customtableview.png?imgmax=800" alt="customtableview.png" border="0" height="405" width="550" />
<p style="text-align: center;"><em>Left: a default <code>UITableView</code> with three rows. Right: the same table view after customization.</em></p>
<h4>How to fail at UITableView customizing</h4>
<p>Coming from Mac OS X made it harder for me — <code>UITableView</code> needs to be customized in a very particular way and structurally, it is very different to Mac OS X's <code>NSTableView</code> and <code>NSCell</code> drawing.</p>
<p>The following are all <em><strong>really bad ways</strong></em> to customize a table (even though you can make it work):</p>
<ul>
    <li>Subclassing <code>UITableView</code> to customize drawing</li>
    <li>Subclassing <code>UITableViewCell</code> to customize drawing</li>
    <li>Creating your own array of <code>UITableViewCell</code>s and returning these instead of using <code>dequeueReusableCellWithIdentifier:</code></li>
</ul>
<p>About the second point: it is okay to customize <code>UITableViewCell</code> — but you shouldn't really use it for drawing. The <code>UITableViewCell</code> class is more of a controller class — it handles behaviors and layout, not drawing. You can customize <code>UITableViewCell</code> to load a specific <code>contentView</code> (and do the custom drawing there).</p>
<p>That last point (that you should always use <code>dequeueReusableCellWithIdentifier:</code>)
is only peripherally related to drawing but it will significantly slow
your drawing down if you avoid the normal cell queuing architecture.</p>
<h4>How to succeed at UITableView customizing</h4>
<p>There are only a few points to understand related to table drawing.</p>
<p><strong>First</strong>: the <code>UITableView</code> does not itself draw anything except the background. To customize the background of a <code>UITableView</code>, all you need to do is set its <code>backgroundColor</code> to <code>[UIColor clearColor]</code> and you can draw your own background in a view <em>behind</em> the <code>UITableView</code>.</p>
<p><strong>Second</strong>: The <code>tableHeaderView</code> (and the
table footer and section headers and footers) need not be just a title.
You can insert your own view, with its own subviews in the table header,
giving layout and custom drawing freedom.</p>
<p><strong>Third</strong>: <code>UITableViewCell</code> is composed of 5 different subviews. Customizing the right subview is the secret to good <code>UITableViewCell</code> drawing. The subviews are:</p>
<ol>
    <li><code>backgroundView</code> — the entire background of the row (including what looks like the <code>UITableView</code>'s background in <code>UITableViewStyleGrouped</code> style tables.</li>
    <li><code>selectedBackgroundView</code> — replaces the <code>backgroundView</code> when the row is selected.</li>
    <li><code>image</code> — a customizable image (not actually a subview) at the left of the cell.</li>
    <li><code>accessoryView</code> — a customizable view at the right of the cell.</li>
    <li><code>contentView</code> — a customizable view between the <code>image</code> and the <code>accessoryView</code> (technically, it extends behind the <code>image</code>).</li>
</ol>
<p>You can customize any of these (except <code>image</code> which must be a <code>UIImage</code>) using your own custom drawn views.</p>
<p>However, since the pixel size of the table never changes, it is often easiest just to use <code>UIImageView</code>s
for each of them. Then you can take highly complex views drawn in
separate programs, cut them into the 5 necessary pieces and let the
automatic caching of <code>UIImage</code>'s named image cache manage your memory for you.</p>
<p>There is an argument against drawing your views in code and that is
that the iPhone's drawing is not nearly as fast as Mac OS X. Operations
like gradients and multiple overlapped components can really tax the
iPhone.</p>
<p>Custom drawing code is a good choice for simple and flat colour
drawing. In most other cases — as in this post — I recommend you use <code>UIImageView</code> to draw your views in a table.</p>
<h4>Implementation</h4>
<p>With all custom drawing handled by <code>UIImageView</code>, that still leaves some work to do. You must handle all layout and configuring of views.</p>
<h5>Configuration of the UITableView and layout of the table header</h5>
<p>As an example of what that means, have a look at the <code>viewDidLoad</code> method for this post:</p>
<pre>- (void)viewDidLoad
{
//
// Change the properties of the imageView and tableView (these could be set
// in interface builder instead).
//
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
tableView.rowHeight = 100;
tableView.backgroundColor = [UIColor clearColor];
imageView.image = [UIImage imageNamed:@"gradientBackground.png"];
//
// Create a header view. Wrap it in a container to allow us to position
// it better.
//
UIView *containerView =
[[[UIView alloc]
initWithFrame:CGRectMake(0, 0, 300, 60)]
autorelease];
UILabel *headerLabel =
[[[UILabel alloc]
initWithFrame:CGRectMake(10, 20, 300, 40)]
autorelease];
headerLabel.text = NSLocalizedString(@"Header for the table", @"");
headerLabel.textColor = [UIColor whiteColor];
headerLabel.shadowColor = [UIColor blackColor];
headerLabel.shadowOffset = CGSizeMake(0, 1);
headerLabel.font = [UIFont boldSystemFontOfSize:22];
headerLabel.backgroundColor = [UIColor clearColor];
[containerView addSubview:headerLabel];
self.tableView.tableHeaderView = containerView;
}</pre>
<p>This method handles the configuration of the <code>tableView</code> (setting the <code>backgroundColor</code>, <code>rowHeight</code> and sets an image behind the table) but also creates its own layout for the table header.</p>
<p>The layout of the header here is for the table's header view. You can
include a custom header for every table section by implementing the <code>UITableViewDelegate</code> method <code>tableView:viewForHeaderInSection:</code>. There are equivalent properties and methods for the table and section footers.</p>
<p>It is possible to handle this type of layout in Interface Builder and
load the XIB files for this type of layout. Sadly though, on the
iPhone, reading loading lots of views from XIB files is slow (I suspect
this is due to slow reading from the Flash memory) and doesn't always
allow configuration of every property.</p>
<p>For this reason, I normally sketch my views in Interface Builder and
then manually recreate the same thing in code. That's what I've done
here: picking coordinates for the <code>headerLabel</code> that looks balanced in the view.</p>
<h5>Cell backgrounds</h5>
<p>The cell background needs to incorporate the tops and bottoms of table "sections". For this reason, the <code>backgroundView</code> and <code>selectedBackgroundView</code> normally need to be set on a row-by-row basis.</p>
<p>In your <code>tableView:cellForRowAtIndexPath:</code> method where you are configuring the cell for a given row, this code will handle that behavior:</p>
<pre>UIImage *rowBackground;
UIImage *selectionBackground;
NSInteger sectionRows = [aTableView numberOfRowsInSection:[indexPath section]];
NSInteger row = [indexPath row];
if (row == 0 &amp;&amp; row == sectionRows - 1)
{
rowBackground = [UIImage imageNamed:@"topAndBottomRow.png"];
selectionBackground = [UIImage imageNamed:@"topAndBottomRowSelected.png"];
}
else if (row == 0)
{
rowBackground = [UIImage imageNamed:@"topRow.png"];
selectionBackground = [UIImage imageNamed:@"topRowSelected.png"];
}
else if (row == sectionRows - 1)
{
rowBackground = [UIImage imageNamed:@"bottomRow.png"];
selectionBackground = [UIImage imageNamed:@"bottomRowSelected.png"];
}
else
{
rowBackground = [UIImage imageNamed:@"middleRow.png"];
selectionBackground = [UIImage imageNamed:@"middleRowSelected.png"];
}
((UIImageView *)cell.backgroundView).image = rowBackground;
((UIImageView *)cell.selectedBackgroundView).image = selectionBackground;</pre>
<h5>Layout within the contentView</h5>
<p>Layout of elements within the <code>contentView</code> need only be set on construction of the <code>contentView</code> (not on a row-by-row basis).</p>
<p>Sadly, laying out <code>UILabel</code>s in the <code>contentView</code> (like the "Cell at row X." and "Some other infomation." lables in this example) is a little verbose.</p>
<p>The following code is run immediately after the allocation of the <code>UITableViewCell</code> to position the "Cell at row X." label:</p>
<pre>const CGFloat LABEL_HEIGHT = 20;
UIImage *image = [UIImage imageNamed:@"imageA.png"];
//
// Create the label for the top row of text
//
topLabel =
[[[UILabel alloc]
initWithFrame:
CGRectMake(
image.size.width + 2.0 * cell.indentationWidth,
0.5 * (aTableView.rowHeight - 2 * LABEL_HEIGHT),
aTableView.bounds.size.width -
image.size.width - 4.0 * cell.indentationWidth
- indicatorImage.size.width,
LABEL_HEIGHT)]
autorelease];
[cell.contentView addSubview:topLabel];
//
// Configure the properties for the text that are the same on every row
//
topLabel.tag = TOP_LABEL_TAG;
topLabel.backgroundColor = [UIColor clearColor];
topLabel.textColor = [UIColor colorWithRed:0.25 green:0.0 blue:0.0 alpha:1.0];
topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
topLabel.font = [UIFont systemFontOfSize:[UIFont labelFontSize]];
//
// Create a background image view.
//
cell.backgroundView = [[[UIImageView alloc] init] autorelease];
cell.selectedBackgroundView = [[[UIImageView alloc] init] autorelease];</pre>
<p>In my mind, it seems like there should be a more efficient way to do this. I hold out the possibility that there is.</p>
<p>This code spends most of its time working out where the label should be placed. It needs to go right of the image, left of the <code>accessoryView</code>, middle of the row but above the "Some other information." label.</p>
<h5>Other adornments</h5>
<p>The <code>accessoryView</code> is just a <code>UIImageView</code>. The <code>cell.image</code> is set as a property. These are extremely simple additions but they make the table cells far more impactful.</p>
<h4>Conclusion</h4>
<blockquote>You can download the <a href="http://projectswithlove.com/projects/EasyCustomTable.zip">EasyCustomTable project as a zip file</a> (60kb).</blockquote>
<p>The code includes a <code>#define</code> at the top that allows you to toggle the custom drawing on and off.</p>
<p>None of this is particularly revolutionary (it is all in the iPhone
documentation) but it is still easy to miss the properties and methods
that make it easy.</p>
<p>This does require custom images. If you've never drawn anything, now is a good time to learn <a href="http://www.inkscape.org/">inkscape</a>
(it's free and very good for the price). You could also use Adobe
Illustrator but if you have that much money, pay an artist to draw it
for you.</p>
<p>Layout of the content in code is probably the weakest part of the
approach I've presented. To make it easier, you can pre-layout
everything in Interface Builder and copy the layout into code. For
complicated layouts, you could even try using <a href="http://github.com/akosma/nib2objc/tree/master">nib2objc</a>
to convert your XIB files to code automatically (although I've never
done this, I'm just mentioning nib2objc because the idea is so cool).</p>
</span>
<img src ="http://www.blogjava.net/sealyu/aggbug/333863.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-07 12:35 <a href="http://www.blogjava.net/sealyu/archive/2010/10/07/333863.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Objective-C – Convert NSString to int and Vice Versa</title><link>http://www.blogjava.net/sealyu/archive/2010/10/05/333773.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Tue, 05 Oct 2010 13:01:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/05/333773.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333773.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/05/333773.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333773.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333773.html</trackback:ping><description><![CDATA[<p><font color="#880088">Convert NSString to int</font></p>
<div class="syntaxhighlighter  objc" id="highlighter_331963">
<div class="bar     ">
<div class="toolbar"><a class="item viewSource" style="width: 16px; height: 16px;" title="view source" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#viewSource">view source</a><a class="item printSource" style="width: 16px; height: 16px;" title="print" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#printSource">print</a><a class="item about" style="width: 16px; height: 16px;" title="?" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#about">?</a></div>
</div>
<div class="lines">
<div class="line alt1">
<table>
    <tbody>
        <tr>
            <td class="number"><code>1</code></td>
            <td class="content"><code class="objc keyword">NSString</code> <code class="objc plain">*aNumberString = </code><code class="objc string">@"123"</code><code class="objc plain">;</code></td>
        </tr>
    </tbody>
</table>
</div>
<div class="line alt2">
<table>
    <tbody>
        <tr>
            <td class="number"><code>2</code></td>
            <td class="content"><code class="objc datatypes">int</code> <code class="objc plain">i = [aNumberString intValue];</code></td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
<p>&nbsp;</p>
<p><font color="#880088">Convert int to NSString</font></p>
<div class="syntaxhighlighter  objc" id="highlighter_739697">
<div class="bar            ">
<div class="toolbar"><a class="item viewSource" style="width: 16px; height: 16px;" title="view source" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#viewSource">view source</a><a class="item printSource" style="width: 16px; height: 16px;" title="print" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#printSource">print</a><a class="item about" style="width: 16px; height: 16px;" title="?" href="http://ykyuen.wordpress.com/2010/04/02/objective-c-convert-nsstring-to-int-and-vice-vesa/#about">?</a></div>
</div>
<div class="lines">
<div class="line alt1">
<table>
    <tbody>
        <tr>
            <td class="number"><code>1</code></td>
            <td class="content"><code class="objc datatypes">int</code> <code class="objc plain">aNumber = 123;</code></td>
        </tr>
    </tbody>
</table>
</div>
<div class="line alt2">
<table>
    <tbody>
        <tr>
            <td class="number"><code>2</code></td>
            <td class="content"><code class="objc keyword">NSString</code> <code class="objc plain">*aString = [</code><code class="objc keyword">NSString</code> <code class="objc plain">stringWithFormat:</code><code class="objc string">@"%d"</code><code class="objc plain">, aNumber];</code></td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
<hr />
<strong></strong>
<img src ="http://www.blogjava.net/sealyu/aggbug/333773.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-05 21:01 <a href="http://www.blogjava.net/sealyu/archive/2010/10/05/333773.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to Use UIDatePicker From UIKit in iPhone Programming</title><link>http://www.blogjava.net/sealyu/archive/2010/10/04/333744.html</link><dc:creator>seal</dc:creator><author>seal</author><pubDate>Mon, 04 Oct 2010 14:26:00 GMT</pubDate><guid>http://www.blogjava.net/sealyu/archive/2010/10/04/333744.html</guid><wfw:comment>http://www.blogjava.net/sealyu/comments/333744.html</wfw:comment><comments>http://www.blogjava.net/sealyu/archive/2010/10/04/333744.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/sealyu/comments/commentRss/333744.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/sealyu/services/trackbacks/333744.html</trackback:ping><description><![CDATA[<p>Here is a great way to ask your users to input dates on your iPhone app.</p>
<p>When you use UIDatePicker in your app you will a tumbler that lets
users select a date that you may use in other parts of your app.</p>
<p>In order to use UIDatePicker you will need to implement the
UIPickerViewDelegate delegate and then add a UIPicker to your subview.
To retrieve the date that the user inputs you can use the target-action
pattern to assign a method to execute once the user has picked a date.
See the video below:</p>
<p>
</p>
<p>Here is the code from the example:</p>
<h3>Implement the UIDatePickerView Delegate</h3>
<p>The first thing we needed to do was indicate that our view controller
would be acting as a delegate for the UITextField. To do this you
simply need to declare it in the interface file:</p>
<pre>#import &lt;UIKit/UIKit.h&gt;
//UIPicker requires an object that adopts the UIPickerViewDelegate protocol
@interface DatePicker : UIViewController&lt;UIPickerViewDelegate&gt; {
}
@end</pre>
<h3>Add the UILabel and UIDatePicker Objects</h3>
<p>This part is straightforward enough: you essentially create a label
and a date picker and add them both to the view controller&#8217;s subview
collection.  This is the typical pattern used to build up a view in
code.</p>
<pre>#import "DatePicker.h"
@implementation DatePicker
UILabel *label;
UIDatePicker *datePicker;
- (void)viewDidLoad {
[super viewDidLoad];
//Create label
label = [[UILabel alloc] init];
label.frame = CGRectMake(10, 10, 300, 40);
label.textAlignment = UITextAlignmentCenter;
//Use NSDateFormatter to write out the date in a friendly format
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
label.text = [NSString stringWithFormat:@"%@",
[df stringFromDate:[NSDate date]]];
[df release];
[self.view addSubview:label];
[label release];
// Initialization code
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 250, 325, 250)];
datePicker.datePickerMode = UIDatePickerModeDate;
datePicker.hidden = NO;
datePicker.date = [NSDate date];
[datePicker addTarget:self
action:@selector(changeDateInLabel:)
forControlEvents:UIControlEventValueChanged];
[self.view addSubview:datePicker];
[datePicker release];
}
- (void)dealloc {
[datePicker release];
[label release];
[super dealloc];
}
@end</pre>
<h3>Implement Your Action Method</h3>
<p>This is the method that you assigned to the UIControlEventValueChanged event above using the target-action pattern.</p>
<pre>- (void)changeDateInLabel:(id)sender{
//Use NSDateFormatter to write out the date in a friendly format
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
label.text = [NSString stringWithFormat:@"%@",
[df stringFromDate:datePicker.date]];
[df release];
}
</pre>
<p>How this works is that when the user stops manipulating the tumbler
an event called UIControlEventValueChanged occurs. Since we assigned the
changeDateInLabel method as an action for this event the code in that
method will execute updating the date in the label.</p>
<h3>Time To Take Action!</h3>
<p>Learning how to program is 5% reading and 95% action so the best way
to learn is to do it yourself.  Create a simple iPhone app that uses the
date picker code.</p>
<p>Let us know how it goes in the comments below!</p>
<img src ="http://www.blogjava.net/sealyu/aggbug/333744.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/sealyu/" target="_blank">seal</a> 2010-10-04 22:26 <a href="http://www.blogjava.net/sealyu/archive/2010/10/04/333744.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>