??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产一区二区三区在线观看,久久亚洲国产视频,亚洲国产成人精品女人久久久http://m.tkk7.com/sealyu/category/46336.html--- 博客已迁U至: <a >http://blog.sealyu.com</a> zh-cnSat, 15 Jan 2011 20:49:43 GMTSat, 15 Jan 2011 20:49:43 GMT60好消息!iphone版九宫格日记免费了!http://m.tkk7.com/sealyu/archive/2011/01/16/343039.htmlsealsealSat, 15 Jan 2011 16:11:00 GMThttp://m.tkk7.com/sealyu/archive/2011/01/16/343039.htmlhttp://m.tkk7.com/sealyu/comments/343039.htmlhttp://m.tkk7.com/sealyu/archive/2011/01/16/343039.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/343039.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/343039.htmliphone版九宫格日记免费了!

下蝲地址Qhttp://itunes.apple.com/cn/app/id412804027?mt=8&ls=1

iphone版九宫格1.0版本发布后,收到很多非常好的用户和评P非常感谢大家的支持!
所?/span>
Sealyu军_程序免费,方便更多用户的用!

同时Sealyu 已经q日赶出?.1版本Q近期即发布,新版本中增加了如下功能:
1.增加密码保护功能?
2.使用InAppSettingsKit重新实现?#8220;讄”面?
3.增加"讄日记标题"功能Q您可以自己讄喜欢的单元格标题?
4.修改了启动画面?






九宫格日?.1版本已经提交app store审核Q近期即发布!敬请下蝲试用Q?br />

seal 2011-01-16 00:11 发表评论
]]>
iphone版九宫格日记q入国App Store新品推荐?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2011/01/12/342817.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/342817.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2011/01/12/342817.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/342817.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/342817.html</trackback:ping><description><![CDATA[今天早上H然发现annie里面加了一个黄色的星星:“Featured in App Store”.<br /> 看了一下,原来是进了美国区App Store中Utilitiescȝ新品推荐榜, 非常高兴。最q要抓紧旉Q赶紧加新功能了?br /> <br /> 下面图中的第一个就是了Q?br /> <img src="http://m.tkk7.com/images/blogjava_net/sealyu/diary9-1.jpg" alt="" border="0" /><br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/sealyu/diary9.JPG" alt="" border="0" /><br /> <img src ="http://m.tkk7.com/sealyu/aggbug/342817.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2011-01-12 09:54 <a href="http://m.tkk7.com/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://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/12/15/340826.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/340826.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/12/15/340826.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/340826.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/340826.html</trackback:ping><description><![CDATA[今天iphone版的“胎教?#8221;l于通过审核了,q是我开发的W一个iphoneE序Q程序地址Q?a >http://itunes.apple.com/app/id407952616?mt=8 </a><br /> 通过q个E序的开发,对xcode中Coredata和av两个framework有了初步的了解,逐渐熟悉了Objective-C和xcode的开发风根{? <img src ="http://m.tkk7.com/sealyu/aggbug/340826.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-12-15 20:57 <a href="http://m.tkk7.com/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 deviceshttp://m.tkk7.com/sealyu/archive/2010/12/03/339750.htmlsealsealFri, 03 Dec 2010 13:23:00 GMThttp://m.tkk7.com/sealyu/archive/2010/12/03/339750.htmlhttp://m.tkk7.com/sealyu/comments/339750.htmlhttp://m.tkk7.com/sealyu/archive/2010/12/03/339750.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/339750.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/339750.htmlHopefully someone else will find these useful. Distilled from the Apple guide

  • Icon.png – Home screen icon for iPhone 3 (57×57)
  • Icon@2x.png – Home screen icon for iPhone 4 (114×114)
  • Icon-72.png – Home screen icon for iPad (72×72)
  • Icon-Small.png - Settings/Spotlight icon for iPhone 3 (29×29)
  • Icon-Small@2x.png – Settings/Spotlight icon for iPhone 4 (58×58)
  • Icon-Small-50.png – Spotlight icon for iPad (50×50)
  • iTunesArtwork – Icon for iTunes AdHoc distribution (512×512)

Had a request to make the work flow a little easier heres those icons in descending size order

  • iTunesArtwork – Icon for iTunes AdHoc distribution (512×512)
  • Icon@2x.png – Home screen icon for iPhone 4 (114×114)
  • Icon-72.png – Home screen icon for iPad (72×72)
  • Icon-Small@2x.png – Settings/Spotlight icon for iPhone 4 (58×58)
  • Icon.png – Home screen icon for iPhone 3 (57×57)
  • Icon-Small-50.png – Spotlight icon for iPad (50×50)
  • Icon-Small.png - Settings/Spotlight icon for iPhone 3 (29×29)


seal 2010-12-03 21:23 发表评论
]]>
敏捷初哥忏悔??http://m.tkk7.com/sealyu/archive/2010/11/23/338824.htmlsealsealTue, 23 Nov 2010 08:54:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/23/338824.htmlhttp://m.tkk7.com/sealyu/comments/338824.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/23/338824.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338824.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338824.html在职业生涯的大部分时间里Q我都是按照瀑布模型的方式进行工作。不久之后,我加入了XebiaQ开始以敏捷的方式做zR特别是Q我们一直把遵@ Scrum和XPҎZTDD相结合作为重点强调的实践。从瀑布模型到敏L转变Q就像从宇宙中的一颗行星突然跨到另一颗一样巨大。一旦完成这U{变, 你的世界发生翻天覆地的变化Q你的思维、工作或协作方式{等Q所有一切都会改变?/p>

我参加的队伍?名专业h士组成,Z我意料的是我们中?个之前根本没有Q何采用敏捷完成工作的l验。这P我们在其?名有l验的同伴指g开 始工作了。一开始,让h高兴的事情ƈ不多Q大部分的事情都让h感到沮。我们认识到Q敏捷ƈ不只是冲刺(SprintQ和没有文 - 有不细微之处你得花功夫学才行?/p>

q里说明一下曾l发生过的事情:

开始的ȝ

  1. 思维转变

敏捷讲的全是当下的考量、当前的冲刺、当前的用户故事{。当一路走来突然有其他某个故事出现在面前的时候,我们q不会事先考虑事情如何发展。过? 在瀑布模型里,我们常常是首先考虑整个pȝQHLDQ高层设计)和LLDQ低层设计)是第一步,在l前q之前,它们必须ȝ?/p>

相反Q敏L内容完全是当前状态和不断改变Q要是我们的需求未来会变化Q我们的设计也将随之演变Q但是我们对于超当前冲刺的事情q不是特别关注。要接受q一事实得花Ҏ间?/p>

  1. 持箋换

敏捷是一个不断变化的环境?#8220;响应变化”是其d原则之一。ؓ了响应,开发者必跟市面上的技术保持同步,否则它将让你异常痛苦?/p>

我们曑֜目中用了一U搜索引擎库Q但我们中只有一人对其有了解。由于这个缺P我们在估时、结寏V站立式会议Q以及其他日常实践里都遇C问题?/p>

我们面对的另一个问题是恰当地进行TDD。从技术观点看QTDD已经有了不少选择。你可以依赖不同的模拟和试框架Q这些往往都是你在瀑布模型里不使用的东ѝ要是你想采用TDDQ那么就必须具备对它们的丰富知识Q否则整个过E就不会太顺利?/p>

~慢地冲?/h2>
  1. 试驱动开发说的是先写试Q然后由试导出业务逻辑。这是最N应的事情之一Q因为它完全颠覆了你的观c?

    在瀑布模型里,L代码先完成,然后再进行些试Q通常都有Q但qL有)Q但TDD则完全是U、绿和重构。这U方法要求我们用抽象术语 q行思考,然后由它们演变出具体的事物。由于一开始难以适应Q我们往往求助于先写出逻辑Q然后确保存在覆盖它们的试。我把这UCؓ开发驱动测试(DDTQ? Ҏ?/p>

    DDTq没有增加太多的意义。假如你知道你的代码会很好地工作,那ؓ何还要写个测试呢Q只是要证明q段代码实有效Q应该不止这一炏V的是q样。例如,写测试可以让你的代码在耦合性方面表现更好,而且q能够ؓ来的代码变更提供一个巨大的安全|?/p>

  1. 在敏捷里Q以抽象术语q行思考是开发h员必d备的技能。在敏捷中我们ƈ不像瀑布模型那样q行预先设计Q通过创徏抽象和开发工作流Q设计到了一定的时候自然就会现w。敏捷中的开发h员必至精通基本的设计模式Q否则他们将产生一大堆垃圾代码Q从中只能得出拙劣的设计?

    TDD在这里对我们大有帮助。它要求我们按抽象术语进行思考。此外,只要我们开始修Ҏ试,我们必考虑q行重构Q让我们的代码变得更 好。DDT也能帮助我们立即识别M质量问题Q这样它们就能及时地得到修复。这P我们最l认识到必须抛弃“首先~代码,然后写测?#8221;的套路,后来我们? 新开始采用了TDDҎ?/p>

  1. 代码质量是团队的职责Q团队成员将时不时的重构代码或者可能会重新~写Q直到它W合预先制订的标准。我们不要把M情A跟我们的代码兌 hQ应该准备不断地抛弃或重写它。遵循Venkat Subramaniam在集体所有制实践斚w的徏议:“每次执行入代码操作时Q我们都应该致力于改善代码的质量?#8221;
  1. 在瀑布模型里,需求是要签字的Q有点像血誓,然后你再l箋向前Ud。但在敏捷里Q需求与解决Ҏ同步演变。这帮助我们在前q的q程中让? 情变得越来越清晰Q但q也Dpȝ需要不时的重新设计Q在最初的冲刺Q?-4Q里Q这U情늻怼发生。此外,Backlog也能在冲刺的中间改变Q因 此,团队应该Ҏq些变化q行调整Q因为在每个冲刺l束时交付可工作的Y件是敏捷的右铭?/li>
  1. l对一开始让得是费旉和精力。两Z起在同一故事上进行工作就像是各浪费了一半的旉和精力。而且Q多人完成同一故事的不同Q务似乎是D速度下降的原因?

    但是Q敏捷中的团队钟情于q种合作做事的方式,不喜Ƣ相同项目组或房间里的h单枪匚w地干zR当团队一起工作时Q他们会竭尽所能地把事情向前推q,l果你有极大的可能性是以一致的方式完成事情Q而不是最l在多个战线失利?/p>

  1. 在采用TDDӞl对的效果最好。Driver和Navigator一起努力开发更好的pȝ。但如果你是按照DDT的方式进行结对编E, 那它׃是最佳的前进之\。在q种情况下,两个合作者都不会知道该如何前q,例如pȝ设计应该像什么样子,q样你将得到很多噪音Q生最l必重写的一? 源代码文件?

    遵@TDD是最佳的方式Q但要是你还没有适应它,你仍然可以结对:利用一块玻璃(白)板,首先d某个设计程图,然后其中一个合作者可以编写代码,而另一个则可以~写试用例?/p>

  1. 在演C时交付可工作的软g像是冲刺的“矌试”。但是,要是软g不是可发布的Q你会不会仅仅因Y件可以构建、可工作Q而认Z个冲刺就成功了呢Q?

    当个别故事全部完工而某些没有,q样的冲刺算不算成功呢?那假如冲刺的全部故事基本完成但还有些烦h的小问题呢?

    团队应该x让整个故事完工,所有问题得到解冻Iq且满完工标准Q而不是慌慌张张地盯着Backlog马虎了事。一ơ实施蹩脚的冲刺没有 M意义Q除了在l箋前进之前必须已完成的事情返工。时间常常是一个约束条Ӟ因此Ҏ故事的相寚w要程度,团队应该扑և一U对他们提议的解x案更? 质量意义的实施方法。位于Backlog端的故事必d量以最好的方式开发解冻I随着我们逐渐Ud到Backlog的底部,对解x案的质量可能会有? 妥协Q但q不是对完工标准而言。对于故事的实现Q更好的方式是宁~勿滥?/p>

  1. 站立式会议是铁律。它们意味着成ؓ一个共享^収ͼ不只是你个h的有Z告诉其他Z做过什么和接下来要做什么。h们应该试囑֎們֐周遭发生的事情,而不只是查自q查表看完成了哪些zd?

    庄严的站立式会议也必L制在一定时间之内。我们常怼抑制不住开始就某个问题q行讨论的诱惑,但那是必要避免的?/p>

  1. 敏捷团队相当,在这样一个环境里Qh们经怼因ؓ他们在站立式会议上的a被他h评判。那么,你就应该说我们在彼此q行脑力Ȁ荡或者我昨天什么也没做Q再或者是我们重构了代码,而现在我搞不清楚怎么回事了之cȝ事情吗?q些都只会给Ch造成一U尴的局面?/li>
  1. 计划会议肯定是费脑子和让人精疲力竭的zd。坐在椅子里4个钟头确定故事点数就像是在玩轮盘赌。这些数字将军_包含在冲刺里的内容,但是怎样在你Ҏ没有l验的时候决定数字呢Q你一定会估计错误?

    但这些数字注定就是可能会出错的大致数字,qƈ不意味着你纯_Ҏ靠运气来开始玩轮盘赌。这些数字在未来的几个冲Z后将l予你某U指C,告诉你能够完成的工作量?/p>

  1. 分配故事Ҏ是一个复杂的dQ应该按阶段完成。团队内部应该首先分析故事,q与产品负责行讨Z清晰C解需求。在得到清晰的视? 之后Q就要进行广泛的技术讨论,考虑可以实现的最佛_能解x案。这步要是完成不好,导致在故事应该如何实现斚w模棱两可Q进而导致有~陷的估计。假 设,如果某个故事接触C一个新的未探烦领域Q那么它应该会相当复杂,即便它是一个简单的d。即使在已知领域Q技术解x案的不同也会D故事相当? 杂?

    单干脆的故事最Ҏ被估,x楚地知道需求是什么,再加上点应该如何实现的细节。品负责h无法提供q么q脆的故事。它们只能通过跟团队一赯论得出来。因此,团队必须q旉来ؓ下一个冲行调整?/p>

  1. 回顾像是在投票旉被赐予的演讲。我们应该已l完成这个或那个Q在下一个冲刺里我们可以完成q个或那个,但是要是q个冲刺里没有接受某 些活儿,什么都不会发生。h们可以表辑և对于不同斚w的满意与否,但是团队应该着g从回儡观点里得到某些具体Q务,否则境况永q保持下厅R?/li>

在扎q敏捷之前,你可以做点准备工作:

  1. 熟悉市面上的技术,其是像JUnit、Fitnesse、EasyMockq样的测试工兗此外,Z应该不断Cؓ更好的解x案而奋斗,因此出去找找改进程的新工具和新ҎQ寻找解军_复出现的问题的新框架或新设计思想和模式?/li>
  1. Venkat Subramaniam和Andy Hunt?#8220;高效E序员的45个习惯:敏捷开发修g?#8221;是每位涉xL开发者的必读书籍?/li>
  1. 读读Robert C Martin在objectmentor.com上的“Craftsman series”?#8220;Clean Code” 。一开始,你可以不用急着去读它们Q但在你到一堆麻烦的时候,你就会知道什么时候该去读了?/li>
  1. 在站立式会议/计划/讨论Qh们评C的时候中保持一颗开攄心。说Z的观点,或者必要的时候要求帮助,你是q个目的受益h?/li>
  1. 试不仅仅是Z代码覆盖率或质量度量。它们还提供了某U类型的持箋保持更新的文。h们可以先看看试代码Q然后就知道该如何用这D代码了?/li>
  1. 在项目开始就自动化构E的所有事情。如果像Checkstyleq样的小事都遗漏了,那么它的l果跟其他模型里的一P说得多做得少。当你意识到q一点,求助于某U补救手D|Q时间往往都太晚了?/li>

学会说A到ZQ然后再让你忘记Q重新学Z到A往往不会太容易。这会带来些痛苦Q但完成转变之后Q你׃知道q样做是值得的?/p>

话就说这么多Q同志们Q上路吧Q!:)

查看英文原文Q?a >Confessions of A New Agile Developer



seal 2010-11-23 16:54 发表评论
]]>IPhoneE序发布到应用程序商店的程Q{Q?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/11/23/338775.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/338775.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/11/23/338775.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/338775.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/338775.html</trackback:ping><description><![CDATA[<p>用传真机试过Nơ,又用faxzero试过Nơ以后,全部都提C失败。但是,世事如此难料Q今天凌晨收C信用卡境外消?9元的短信提醒,早上h信箱里就已经收到了激zȝQ点击链接就ȀzM自己的开发者̎受也不知道是哪一ơ传真发成功了?/p> <p>d开发者中心,右侧有个Portal的链接,点击q去是自己账号的管理中心,初次q入有个向导Q可以帮你创Z个开发者证书。最好是下蝲它的? 整的向导说明书,是一个PDFQ?M多,步骤q是l的。但是这本手册在|上没有见过中文版的说明Q所以在q里单介l一下?/p> <p>q个开发者中心的用户权限分三U类型:AgentQAdminQDeveloper。Agent拥有完整的管理权限,Admin也可以管理用户和? 书,Developer只能理自己的证书和讑֤。只有Agent有上传Y件到App Store的权利。(但是我没有看到添加其它用L功能Q可能需?99元的̎L型才会有Q我自己的̎L录进来就是个Agent了)?/p> <p>对于个h开发者,你需要完成以下几个过E:</p> <p>甌一个Development证书 > 讄你的IPhone手机 > 创徏一个App ID > 创徏q下载安装一个Development Provisioning Profile。经q这几步Q你写的E序可以跑在自q手机上了Q否则只能在虚拟机里面运行)?/p> <p>然后甌一个Distribution证书 > 创徏q安装一个Distribution Provisioning Profile > ~译你的E序 > 可以发布到App Store了?/p> <p></p> <p>下面详细介绍一下:Q不知道有没有必要,毕竟C证书的h都可以下载到q篇很简单的英文文Q,所有的介绍以中文版的Mac OS X的菜单和E序名ؓ?/p> <p><strong>开发者证书安装步骤:</strong></p> <p>打开应用E序中的“钥匙串访?#8221;Q在菜单里点?#8220;证书助理”下面?#8220;从证书代理请求证?#8221;Q注意下面不要选中M行,否则菜单会变。输入自q注册 EmailQ常用名U可以写详细一点,比如“Unfish Dev Key”Q下面选中“存储到磁?#8221;Q点l箋Q可能会出现未知错误Q多试几ơ就OK了。然后在览器中q入开发者中心的CertificatiesD? 面,在Development面中最下面选择刚才创徏的证书文Ӟ点上传。然后证书就会显C出来,q要再点一下后面的Approve按钮Q页面刷新后q? 个证书就可以下蝲了。下来是个cer文gQ双M自动导入Q导入类型选择“d”可以?/p> <p>然后是添加自q手机讑֤到xcode。把手机q到电脑上,在xcode的windows菜单下打开OrganizerQ左边的devices下面 会列Z的手机,双的Identifier就是你的手机的udidQ复制下来,待会要用。如果这个手没有讄q作为开发机Q这个界面上应该会有? 个按钮,点一下就可以把它设ؓ开发机Q在xcode里点Build and go的时候就可以自动的安装你的程序到手机上,不需要通过ITunes了。在开发者中心的左边DevicesD里点Add DeviceQv个自p识的名字Q把udid_脓q去可以了。(q一步只是开发证书有用,发布证书是不需要这个东西的。)</p> <p>然后需要创Z个App IDQ在开发者中心的App IDsD创Z个新的App IDQ这个App ID需要跟E序的info.plist里面定义的程序Identifier相对应,如果q里只输入一?Q那么info.plist那里写什么都可以Q徏议用*?/p> <p>然后q入开发者中心的Provisioning菜单Q在Development面创徏一个新的ProvisioningQ需要选择所使用的证 书,App IDQ和对应的设备,生成以后下蝲q个provisioning文gQ把下蝲下来的文件拖到Dock上的Xcode的图标上׃自动安装q去。然后退? xcode重新打开Q打开你的目Q打开Project菜单下面的Edit Project SettingsQ进入Build面Q找C面的Code Signing IdentityQ把Any iPhone OS Device后面选中你的开发者证书,然后可以把目的编译目标设为DeviceQ而不是模拟器Q,试一下Build and Go了。程序应该会~译完ƈ自动安装C的手ZQƈ自动启动了?/p> <p><strong>发布证书安装步骤Q?/strong></p> <p><span style="text-decoration: line-through;">再用钥匙串讉K里面?#8220;从证书代理请求证?#8221;功能Q输入自qEmailQ名U要写购买证书时d的公司名或者个人名Q下面选中“保存到磁?#8221;?#8220;让我自己选择U钥”Q下一步,把证书保存下来?/span></p> <p>q入开发者中心Certificates里面的Distribution面Q选择前面保存的文件上传,然后Approve一下,下蝲q个证书Q双d入,cd选登录?/p> <p>q入开心者中心Provisioning里面的Distribution面Q添加新的ProvisioningQ类型选App StoreQ(如果选了Ad HocQ就只有你添加过udid的手机才能安装这个程序了Q,证书应该是自动出现的QApp ID选好Q创建完成,下蝲q个文gQ拖到xcode的图标上安装完成。退出xcode再重新打开Q否则加载不了你刚刚d的那个证书,会出? Provisioning无效的提C?/p> <p>然后打开你的目Q进?#8220;Edit Project Settings”Q进入Configuration面Q选中Release点击下面的DuplicateQ复制一个新的配|项出来Q命名ؓ Distribution。然后进入Build面Q顶上的Configuration下拉框选中DistributionQ下面的Code Signing Identity里面的Any iPhone OS Device后面对应的值选中你的那个Distribution的证书。然后就可以~译E序了?/p> <p>如果你之前按照类D个教E?a title="http://www.weiphone.com/thread-222380-1-3.html" >http://www.weiphone.com/thread-222380-1-3.html</a>自己生成q证书ƈ且改qProject Settings和info.plistQ需要把q两个地Ҏ回去Q否则编译的时候会出现一个warningQCodeSign warning: <em>provisioning is not applicable for product type</em> ‘<em>Application</em>‘ in SDK ‘Device – iPhone OS 2.2′。删掉Project Setting里面的PROVISIONING_PROFILE_ALLOWED = NO和PROVISIONING_PROFILE_REQUIRED = NOQ以及info.plist的SignerIdentityQ再~译Q应该就不会出错了?/p> <p>E序发布到应用程序商店的步骤Q?/p> <p>在开发者中心的DistributionD里面的App Store面Q在下面的App Store下面的Learn More展开Q就可以看到Go to iTunes Connect的链接。进入以后点击Manage My ApplicationQ就可以d自己的程序了?/p> <p>需要选择E序的语aQ国Ӟ介绍{等基本信息Q然后下一步上传程序和其它囄。这个地方上传的E序Q就是把你的目~译以后生成的那?app的目 录直接压~成zip上传Q(q个.app目录里面的Q何文仉不可以更改,否则{֐׃对了Q。你需要准备一?12×512的png囄作ؓ? LogoQ还需要准?张程序运行的界面截图Q在q个面上挨个选Choose fileQ再点击upload fileQ出现对号就没问题了。然后选择E序的h|默认有很多可以选,free是免费,1?.99元Q??.99元Q诸如此cR如果非免费E? 序,你还得准备一份购买协议?/p> <p>再点下一步,可以等待程序审怺?/p> <p>感觉g很复杂,不过只要按教E上的步骤一步一步的做,肯定是没有问题的?/p> <img src ="http://m.tkk7.com/sealyu/aggbug/338775.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-11-23 12:46 <a href="http://m.tkk7.com/sealyu/archive/2010/11/23/338775.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iphone app 如何联机调试和发布程?99$) (?http://m.tkk7.com/sealyu/archive/2010/11/23/338774.htmlsealsealTue, 23 Nov 2010 04:45:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/23/338774.htmlhttp://m.tkk7.com/sealyu/comments/338774.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/23/338774.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338774.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338774.html

原帖地址  http://www.cocoachina.com/bbs/read.php?tid-7923.html

q两天公司让整理文Q一直想写一更详细的联试的文Q这ơ刚好是Z
我写的只是联试的步骤Qƈ没有深入的去写ؓ什么这么做Q关键是我不知道Q?br /> 希望q篇文章对菜鸟们有帮助,
高手们见了了׃要笑了~~

明天再接着写如何发布程?/p>

必须条gQ?br /> 99$
(没这个就不用再往下看?
我的pȝ?0.5.7   不同版本的系l,可能有点小的区?br /> 首先d?br /> http://developer.apple.com/iphone/index.action

如果已经购买?9$, dq去后会看到如下地方(?)
  

点进M看到如下界面(?)
  

q里我要提一下,公司和个人的$99  Team里面的内Ҏ有所不同?臛_我发现有不同)
公司的Team下面可以加入Member  而个人的不能加入Member只能是一个hQ不q这里ƈ无大,不妨我们下面的内容?br /> 点击q入 Certificates 看到如下内容(?)

点击图中U色部分 会下载下来一个名字ؓ  AppleWWDRCA.cer  的东?br /> q个是调试发布IPHONE E序必须的一个东西,q个东西我们只要下蝲一ơ就够了Q即使你有N个IDPQ那么无论是调试E序Q还是发布程序,那也只需要一个,后面我们要说? Distribution面Ӟ也有q个链接Q如果已l下载过Q那么就不用再下q个了?最初因为对q个程不懂Q我下蝲了Nơ这?Q?br /> 下完之后Q点击这个,q个东西׃装到自己的机器上?br /> 打开你的  Keychain Access Q如果dock里面没有?C?ApplicationsUtilities下面LKeychain AccessQ中文名字好像叫” 钥匙?#8230;” 打开q个Q你会看到如??)

q代表你已经装进M?/p>

下面Q我们打开Keychain的这个菜??)
  

按着下面的图?br /> (?)
  

(?)
  

(?)
  

然后continute
׃生成一个CertificateSigningRequest.certSigningRequest 的文Ӟ在你的桌面上?/p>

下一??)Q?br />   

点击Request Certificate(?0)
  

点击Choose FileQ图11Q?br />

选中CertificateSigningRequest.certSigningRequest

点击ChooseQ图12Q?br />   

点击Submit
(?3)
  

点击Approve
Q图14Q?br />   

q时你的证书是牌Pending的状?br /> h一个网,OK处于如下状?br /> Q图15Q?br />   

q时点击 Download按钮Q会得到一个developer_identity.cer   双击q个文g
Q图16Q?br />   

点击OK
q时再打开你的keychain 看看 会是如下l果
Q图17Q?br />   

切记q时能看C面那?钥匙 状的东西Q如果没有这个,是不可能调试的,以前有时Q我l常看不到那?钥匙 状的东西
OKQ我们l?/p>

打开Devices 那一?br /> (?8)
  

点击 Add Devices
Q图19Q?br />   

l自q讑֤取个名字例如MyIPod
DeviceID 是自己IPod或IPHONE的机w号Q?0位)Q机w号的获取方法有很多Q可能通过 xcode 的window->Organizer 来取?br /> (?0)
  

然后填入表中q点击summit
?1
  

下面我们来搞APPID
?2


点击NewAppID

?3
  

W一处,随便写个名字p了, 我以AppIDZ
W二处,一定要注意了,一定要按着q样的格式写
我这里写的是
com.abc.*
你也可以写成 com.xyz.*    com.google.*  
量中间那个变量有点意义Q一般情况下是公司的名字?br /> 切记一定要写成q种格式Q不然以后会有麻?br /> 然后submit
?4

l箋Provisioning面
?5
  

点击New Profile
按着我的填一?br /> ?6
  

填完?Submit
?7
  

Download 你会得到一?DevProvision.mobileprovision 的文Ӟq个文g是要装到手机里面?/p>

这个拖动到organizer  里面
?8
  

拖动后如?9
  

q时打开你的IPOD 你会发现?nbsp; 讄->通用->描述文g  里面有个东西Q那是你的证书?br /> 然后再双击DevProvision.mobileprovisionq个文gQ然后你的xcode pȀz,q时查看C?br /> Users用户名LibraryMobileDeviceProvisioning Profiles下面 是不是有了一?br /> XXXXXX-XXXXXX-XXXXX-XXXXXX.mobileprovision的文Ӟ

下面随便打开一个IPHONE的工E?br /> 打开那个工程的plist文gQ把Bundle identifierҎ如下
?0
  

现在大概你知?abc 是什么东西了?br /> 打开q个工程的info
?1
  

然后按着下图改一下设|(切记选中你该选中的那一)
?2
  

如果你想选中的那一Ҏ灰色的,那么你前面的某些程一定出了问?/p>

然后q有一处需要确认,如下Q图33Q?br />   

L认,U色是部分是你应该选中?br /> ?4
  

OK
现在已经大功告成?99.9999%?br /> 选中Device…  Debug    然后 Build and Go
?5
  

E序肯定已经跑在你的机器上了Q如果不行,那么重v一下你的IPODQ如果再不行那就重v一下你的电脑,如果再再不行那就自己惛_法吧

l?br /> 接着如何发布E序
打开Certificicates 的Distribution面
Q图36Q?br />   

点击 Request Certificate按钮(有上面联试的步骤q个q程一定很熟了?
Q图37Q?br />   

选中CertificateSigningRequest.certSigningRequest  文g(q个文g在联试的q程中已l生成过?Q?br /> ?8
  

选中然后点击Submit
?9
  

点击Appove
?0
  

q时需要刷C下页?br /> ?1
  

点击DownLoad
会得C个名为distribution_identity.cer 的文?br /> 双击q个文gQ会有如下提C?br /> ?2
  

点击OK
然后打开keychain ׃看到如下的图
?3
  

q时你的电脑已l具备发布程序的证书?/p>

下面打开Provisioning 的Distribution面
?4
  

点击New Profile
然后按着下图填一下,Profile Name 随便写个名字p?br /> ?5
  

然后Submit
?6
  

h一?br /> ?7
  

OK现在Download Q你会得C?Distribution.mobileprovision 的文?br /> 双击q个文gQ你的xcode 会被Ȁz?br /> 查看C?br /> Users用户名LibraryMobileDeviceProvisioning Profiles下面 又多了一?br /> XXXXXX-XXXXXX-XXXXX-XXXXXX.mobileprovision的文?/p>

现在我们再配|一下xcode
?8
  

打开Configurations 面
选中Release 然后Duplicate 一?br /> ?9
  

Duplicate之后如下?br /> ?0
  

我们把名字改成Distribution
?1
  

接着我们切换到Build 面
?2
  

图中1处选中Distribution   2处选中Distribution
然后
?3
  

?4
  

定?4中,是你应该选的Q不然build时会出现{֐错误

定之后Ql?br /> ?5
  

选中Device ?Distribution
OK
?6
  

Build  OK  大功告成?9.9%?/p>

q时如果有签名错误,那一定是你上面某个地方出了问?/p>

成功?br /> ?7
  

其中的iHide 是我们要上传的东西Q在上传之前Q我们要把他压羃?zip ?/p>

现在我们在浏览器中输?br /> itunesconnect.apple.com
d一?br /> ?8
  

q入Manage Your Applications
?9
  

点击Add New Application
……………

OK?br /> 后面的不说了~~~

工具下蝲见原帖地址 http://www.cocoachina.com/bbs/read.php?tid-7923.html



seal 2010-11-23 12:45 发表评论
]]>
How to Add iAd Banner in iPhone Apphttp://m.tkk7.com/sealyu/archive/2010/11/20/338569.htmlsealsealSat, 20 Nov 2010 14:58:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/20/338569.htmlhttp://m.tkk7.com/sealyu/comments/338569.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/20/338569.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338569.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338569.htmlIn April 2010 during iOS 4 presentation Steve Jobs announced new advertisement platform – iAd. This platform is intended to allow developers of free apps to earn on their apps showing advertisement. The main idea of iAd is to connect interactivity (using smartphone or tablet) and emotionality of advertisement (JavaScript, HTML5, CSS3, multi-touch). It allows to create absolutely awesome advertisement 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.

Below is the guide on how to add iAd banner into iPhone app. Guide is based on iAd Programming Guide and WWDC 2010 video.

Add iAd Banner to iPhone App

The first thing you need to do is to add iAd.framework in your Xcode project which is contained in iOS 4 SDK. Also do not forget to add #import <iAd/iAD.h>. Developers can choose between two banners: 320×50 px for portrait and 480×32 px for landscape. The base of banner is ADBannerView, which is subclass of UIView. So the only thing you have to do is to add this view in your control elements hierarchy (you can do this programmatically or using Interface Builder).

iOS 4 SDK Interface Builder

Apple recommends to put banner at the bottom or at the top of the window and do not place it on any moving elements like ScrollView or TableView 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.

Let’s create a new project in Xcode using View-based Application template and add a banner into it. Name of the app – iAdEx. We are going to edit iAdExViewController.h

1
2
3
4
5
6
7
8
9
10
#import <UIKit/UIKit.h>;
#import <iAd/iAd.h>;
 
@interface iAdExViewController : UIViewController <ADBannerViewDelegate>
{
      ADBannerView *adView;
      BOOL bannerIsVisible;
}
@property (nonatomic,assign) BOOL bannerIsVisible;
@end

and modify viewDidLoad method in iAdExViewController.m

1
2
3
4
5
6
7
8
9
10
- (void)viewDidLoad {
      adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
      adView.frame = CGRectOffset(adView.frame, 0, -50);
      adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
      adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
      [self.view addSubview:adView];
      adView.delegate=self;
      self.bannerIsVisible=NO;
      [super viewDidLoad];
}

Let’s talk about requiredContentSizeIdentifiers and currentContentSizeIdentifier 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.

Connection issues

Banners are downloaded from the network. What if we have no network connection right now? Or Apple has any issues with ads server? Our ADBannerView will be empty is these cases. It doesn’t look very nice and wastes space on the screen. Apple recommends to do it in this way: when there is no banner for any reason remove it from the screen; when banner is received – show it again.

We have the ADBannerViewDelegate in our class and it can receive messages from banner – bannerViewDidLoadAd (when banner is loaded successfully) and didFailToReceiveAdWithError (when any problems occured). Let’s implement these messages:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
 if (!self.bannerIsVisible)
 {
  [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
// banner is invisible now and moved out of the screen on 50 px
  banner.frame = CGRectOffset(banner.frame, 0, 50);
  [UIView commitAnimations];
  self.bannerIsVisible = YES;
 }
}
 
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
 {
  [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is visible and we move it out of the screen, due to connection issue
  banner.frame = CGRectOffset(banner.frame, 0, -50);
  [UIView commitAnimations];
  self.bannerIsVisible = NO;
 }
}

It’s time to launch the app and see what we have now:

iAd banner on iPhone

Tap the banner

iAd Detailed View on iPhone Simulator

And that’s it – we’ve done it in accordance with Apple’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…

Stop & Resume your app

In real app we should stop any application’s activity such as video, audio playback or pause game. In order to solve this task we will create two methods bannerViewActionShouldBegin (when full screen ad is shown) and bannerViewActionDidFinish (when we close ads).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
 NSLog(@"Banner view is beginning an ad action");
 BOOL shouldExecuteAction = YES;
 if (!willLeave && shouldExecuteAction)
    {
    // stop all interactive processes in the app
    // [video pause];
    // [audio pause];
    }
 return shouldExecuteAction;
}
 
- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
   // resume everything you've stopped
   // [video resume];
   // [audio resume];
}

Change Orientation of iAd

What else should we do? We need to make banner change it’s orientation in accordance with iPhone position. First of all we need to change the line where we define types of banners which we will use:

1
2
3
4
5
- (void)viewDidLoad {
...
adView.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifier320x50,ADBannerContentSizeIdentifier480x32,nil];
...
}

and here are methods for changing orientation:

1
2
3
4
5
6
7
8
9
10
11
12
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations
 return (interfaceOrientation == UIInterfaceOrientationPortrait|UIInterfaceOrientationPortrait);
}
 
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
 if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
  adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32;
 else
  adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
}

And here is how it look in a landscape

iAd banner in landscape mode

When device changes orientation we change currentContentSizeIdentifier property of ADBannerView. Now we can see banners in landscape mode too. There is still 50 px offset, but it’s easy to fix.

Apple developers also recommend to write object.delegate=nil; line before deallocating ADBannerView object. In our example it will look like:

1
2
3
4
5
- (void)dealloc {
 adView.delegate=nil;
 [adView release];
 [super dealloc];
}

Now we have finished with programming part. Good luck with Apple iAd!



seal 2010-11-20 22:58 发表评论
]]>
Cydia commCenter 补丁更新问题的解x?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/11/19/338492.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/338492.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/11/19/338492.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/338492.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/338492.html</trackback:ping><description><![CDATA[Sealyu  2010-11-19<br /> <br /> pȝ iphoneOS4.1, Cydia<br /> <br /> 最q更新Cydia的时候L出错Q在更新Commcenter补丁的时候说要先卸蝲bspatchQ但是在安装bsdiff的时候,bsdiff里也包含bspatchQ所以在队列安装的时候没法满依赖关p,DCydia卡在那里?br /> <br /> 在用l端QTerminalQ用root账户q入iphone文gpȝ后,发现跟Ubuntu{类Debianpȝ差不多,同样安装软g可以适用dpkg和apt-get?br /> 所以参考Ubuntu下安装Y件的解决ҎQ终于解决了q个困扰了几天的问题?br /> <br /> 解决Ҏ如下Q?br /> 1. 打开l端QTerminalQ? loading完后Q输入suQ回车?br /> 2. 输入密码Q默认ؓQalpine<br /> 3. 输入Qdpkg -i --force-overwrite /var/cache/apt/archives/XXX 。(其中的XXX为提C无法覆盖的那个bsdiff_4.3-1xxxxx.deb那个文gQ回?br /> 4. 输入Q?apt-get upgrade, 回R?br /> 4. 重启iphone<br /> 5. q入Cydia查看更新Q搞?br /> <br /> <img src ="http://m.tkk7.com/sealyu/aggbug/338492.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-11-19 17:10 <a href="http://m.tkk7.com/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 Yhttp://m.tkk7.com/sealyu/archive/2010/11/18/338428.htmlsealsealThu, 18 Nov 2010 14:06:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/18/338428.htmlhttp://m.tkk7.com/sealyu/comments/338428.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/18/338428.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338428.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338428.html今天ubuntu9.10 alpha4 升出现了点问题Q?/p>
Preparing to replace language-pack-zh 1:9.10 (using .../language-pack-zh_1%3a9.10+20090805_all.deb) ...
Unpacking replacement language-pack-zh ...
Preparing to replace language-pack-zh-base 1:9.10 (using .../language-pack-zh-base_1%3a9.10+20090805_all.deb) ...
Unpacking replacement language-pack-zh-base ...
dpkg: error processing /var/cache/apt/archives/language-pack-zh-base_1%3a9.10+20090805_all.deb (--unpack):
trying to overwrite `/usr/share/locale-langpack/zh_TW/LC_MESSAGES/sed.mo', which is also in package language-pack-zh-hant-base
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Preparing to replace language-pack-gnome-zh 1:9.10 (using .../language-pack-gnome-zh_1%3a9.10+20090805_all.deb) ...
Unpacking replacement language-pack-gnome-zh ...
Preparing to replace language-pack-gnome-zh-base 1:9.10 (using .../language-pack-gnome-zh-base_1%3a9.10+20090805_all.deb) ...
Unpacking replacement language-pack-gnome-zh-base ...
dpkg: error processing /var/cache/apt/archives/language-pack-gnome-zh-base_1%3a9.10+20090805_all.deb (--unpack):
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

中文的显C是q样Q?/p>

(正在d数据?... pȝ当前d安装?123909 个文件和目录?
正在解压~?language-pack-gnome-zh-hans-base (?.../language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb) ...
dpkgQ处?/var/cache/apt/archives/language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb (--unpack)时出错:
正试图覆?#8220;/usr/share/locale-langpack/zh_CN/LC_MESSAGES/gnome-settings-daemon.mo”Q它属于软g?language-pack-gnome-zh-base
dpkg-deb: 子进E?_脓 被信?Broken pipe)l止?br /> 正在解压~?language-pack-gnome-zh-hant-base (?.../language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb) ...
dpkgQ处?/var/cache/apt/archives/language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb (--unpack)时出错:
正试图覆?#8220;/usr/share/locale-langpack/zh_TW/LC_MESSAGES/gnome-settings-daemon.mo”Q它属于软g?language-pack-gnome-zh-base
dpkg-deb: 子进E?_脓 被信?Broken pipe)l止?br /> 在处理时有错误发生:
/var/cache/apt/archives/language-pack-gnome-zh-hans-base_1%3a9.10+20090819_all.deb
/var/cache/apt/archives/language-pack-gnome-zh-hant-base_1%3a9.10+20090819_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

cMq样的错误:

dpkg: error processing /var/cache/apt/archives/AAA (–unpack):
trying to overwrite `/usr/lib/BBB‘, which is also in package CCC
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
AAA
E: Sub-process /usr/bin/dpkg returned an error code (1)
解决ҎQ?/p>

sudo dpkg -i --force-overwrite AAA

(give full path of AAA), and then run

sudo apt-get -f install

again.



seal 2010-11-18 22:06 发表评论
]]>
解决CYDIA提示wrong language code zh-Hans错误的解x?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/11/18/338422.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/338422.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/11/18/338422.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/338422.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/338422.html</trackback:ping><description><![CDATA[<strong><font size="5">1Q用(ifile, winscp)<span onclick="tagshow(event)" class="t_tag">软g</span>打开q进?private/etc/apt目录 <br /> 2Q重命名<span onclick="tagshow(event)" class="t_tag">文g</span>夹sources.list.dQ随便你叫什么名字,或者传到硬盘备份?<br /> 3Q新Z个文件夹叫sources.list.dQ权?75 <br /> 4Q打开<span onclick="tagshow(event)" class="t_tag">cydia</span>Q你会发现package里已安装文g都出CQ不qsource里的源都没有了,不过无Q何报错了 <br /> 5Q关闭cydiaQ重新Y件回前面的文件夹Q把自己建的sources.list.dl删了,把前面改名的文gҎ回来Q权限改?75 <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>8Q重新添加你喜欢的源</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>9Q至此今后打开Cydia不会再出现wrong language code zh-Hans  了?</strong></font> <img src ="http://m.tkk7.com/sealyu/aggbug/338422.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-11-18 20:25 <a href="http://m.tkk7.com/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 UINavigationControllerhttp://m.tkk7.com/sealyu/archive/2010/11/13/338008.htmlsealsealSat, 13 Nov 2010 15:12:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/13/338008.htmlhttp://m.tkk7.com/sealyu/comments/338008.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/13/338008.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338008.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338008.htmlYes! There is a way of using the backBarButton with a custom action. No, it’s not by overriding the backBarButton property of navigationItem. This is not an ugly solution with images that simulate the “Back”-button (arrow-shaped.) It’s possible to use the backBarButton for popping the current viewController as normal, but than with other animations such as UIViewAnimationTransitionCurlDown.

Enough said, the solution is simple. You have to subclass your navigationController’s  popViewControllerAnimated:(BOOL)animated. So create a custom navigationController:

customNavigationController.h

#import
@interface customNavigationController : UINavigationController {}
@end

And a custom “popViewControllerAnimated:(BOOL)animated”, this popViewControllerAnimated-function uses the “UIViewAnimationTransitionCurlDown” when popping from a SettingsTableView.

customNavigationController.m

#import "customNavigationController.h"
#import "SettingsTableController.h"
 
@implementation customNavigationController
 
- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{
if([[self.viewControllers lastObject] class] == [SettingsTableController class]){
 
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1.00];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:self.view cache:NO];
 
UIViewController *viewController = [super popViewControllerAnimated:NO];
 
[UIView commitAnimations];
 
return viewController;
} else {
return [super popViewControllerAnimated:animated];
}
}
@end

Use your custom navigationController in your appDelegate:

customNavigationController *navigationController =
[[customNavigationController alloc]
initWithRootViewController:rootView];



seal 2010-11-13 23:12 发表评论
]]>
NavigationControllerD栏中d多个UIBarButtonItem(?http://m.tkk7.com/sealyu/archive/2010/11/13/338006.htmlsealsealSat, 13 Nov 2010 14:37:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/13/338006.htmlhttp://m.tkk7.com/sealyu/comments/338006.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/13/338006.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/338006.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/338006.html 在实际的开发中Q导航器是最重要的容器之一Q我们经常要在导航栏中添加各U样式的按钮Q添加一个按钮很单,代码如下图: UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTi

在实际的开发中Q导航器是最重要的容器之一Q我们经常要在导航栏中添加各U样式的按钮Q添加一个按钮很单,代码如下图:

UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UITabBarSystemItemContacts
                                                                 target:self action:@selector(clickSettings:)];         
self.navigationItem.rightBarButtonItem = anotherButton;
[anotherButton release];

其中按钮的样式可以有多种Q具体的可以参考:https://developer.apple.com/library/ios/prerelease/#documentation/UIKit/Reference/UIBarButtonItem_Class/

在有些项目中要在右面d两个按钮Q实现的样式如下图:

 

 

实现的代码如下图Q?/p>

UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 150, 45)];
[tools setTintColor:[self.navigationController.navigationBar tintColor]];
[tools setAlpha:[self.navigationController.navigationBar alpha]];
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];

UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
                        target:self action:@selector(clickSettings:)];

UIBarButtonItem *anotherButton1 = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UITabBarSystemItemContacts
                                                        target:self action:@selector(clickEdit:)];
[buttons addObject:anotherButton];
[anotherButton release];
[buttons addObject:anotherButton1];
[anotherButton1 release];
[tools setItems:buttons animated:NO];
[buttons release];
UIBarButtonItem *myBtn = [[UIBarButtonItem alloc] initWithCustomView:tools];
self.navigationItem.rightBarButtonItem = myBtn;

[myBtn release];
[tools release];



seal 2010-11-13 22:37 发表评论
]]>
文g操作 Q?Objective C 2.0Q{Q?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/11/12/337952.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/337952.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/11/12/337952.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/337952.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/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>q些操作都可以被在directories下执行。例如你创徏一个目录,d其中元素或者删除。另一个特色是link files。也是Q一个相同的文g存在在两个不同的名字下,或许甚至是不同的目录下?/div> <div><br /> </div> <div><span style="white-space: pre;"> </span>Z打开一个文件ƈ执行多次d操作Q你用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>q个cL供的Ҏ也可以被应用在Device 或?socket上?/div> <div><br /> </div> <div><span style="font-size: large;">理文g和目录:NSFileManager</span></div> <div>       一个文件或者目录被通过pathname 唯一的定义给NSFileManager?一个pathname是一个NSStringcd对象能被相关联或者是全部的pathname?/div> <div><span style="white-space: pre;"> </span>一 个相兌的pathname是关联到当前目录的那个pathname ?所以文件名字copy1.m 意味着q个文g在当前的目录?#8220;Q?#8221;QSlashQ?实际上是根目录。/usersQsomone 是一个pathname 指定3个目?Q? 根目录,users目录和someone目录?/div> <div><span style="white-space: pre;"> </span>~被用来~写一个用Lȝ录比如~linda Q?Qusers Q?linda?在UNIXcd的pathname里面 “ ." 是当前目录". . "是父目录(上一U)</div> <div><br /> </div> <div><br /> </div> <div>NSData:</div> <div>用这个类来处理文件的时候,你常帔R要读Z个时区域中的变量,通常叫做bufferQ缓冲区Q。NSDatacL供一个简单的方式建立~冲区,d里面文g的内容,或者写一个buffer中的内容C个文件?/div> <div>你可以定义可变的或者不可变的存储空间?/div> <div><br /> </div> <img src ="http://m.tkk7.com/sealyu/aggbug/337952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-11-12 21:32 <a href="http://m.tkk7.com/sealyu/archive/2010/11/12/337952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iPhone开发之全局变量的??http://m.tkk7.com/sealyu/archive/2010/11/12/337944.htmlsealsealFri, 12 Nov 2010 12:57:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/12/337944.htmlhttp://m.tkk7.com/sealyu/comments/337944.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/12/337944.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/337944.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/337944.html全局变量历来是很好的东西,能够在开发中带来很多方便Q下面来介绍一下iPhone中Y件开发时全局变量的用方法:

一、新建Constants.h文gQ文件名Ҏ需要自己取Q,用于存放全局变量Q?/p>

二、在Constants.h中写入你需要的全局变量名,例如Q?/p>

Object-C代码
  1. NSString *master_url;//指针cd
  2. int count;//非指针类?br />

注意Q在定义全局变量的时候不能初始化Q否则会报错Q?/p>

三、在需要用到全局变量的文件中引入此文Ӟ

Object-C代码
  1. #import "Constants.h"  

四、给全局变量初始化或者赋|

Object-C代码
  1. extern NSString *master_url;  
  2. master_url = [[NSString alloc] initWithFormat:@"http://www.wuleilei.com"];//指针cdQ需要alloc
  3. extern int count;
  4. count = 0;//非指针类?/span>

五、用全局变量Q和使用普通变量一样用?/p>


转自Qhttp://www.wuleilei.com/Blog/193



seal 2010-11-12 20:57 发表评论
]]>
MacE序开发基Q得C个目录内的内??http://m.tkk7.com/sealyu/archive/2010/11/12/337907.htmlsealsealFri, 12 Nov 2010 06:27:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/12/337907.htmlhttp://m.tkk7.com/sealyu/comments/337907.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/12/337907.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/337907.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/337907.html 前面写了 Mac开发基Q打开一个目录的ҎQ下面l,看看如何通过E序得到一个目录的内容?1, 使用NSFileManager来得到这个目录的内容 NSArray * contentArray = [ [ NSFileManager defaultManage

前面写了Mac开发基Q打开一个目录的ҎQ下面l,看看如何通过E序得到一个目录的内容?/p>

1, 使用NSFileManager来得到这个目录的内容

NSArray *contentArray = [[NSFileManager defaultManager] 
contentsOfDirectoryAtURL:[[oPanel URLs] objectAtIndex:0]
//oPanel是上个帖子中的NSOpenPanel对象
includingPropertiesForKeys:[NSArray array]
options:0
error:nil];
//我们得到一个Array的NSURL

2, 单显C个Array中的内容

	for(id innerUrl in contentArray)
{
NSLog([innerUrl absoluteString]);
}

3, l果

run
[Switching to process 3626]
Running…
2010-06-17 23:32:43.409 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0001.xml
2010-06-17 23:32:43.411 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0002.xml
2010-06-17 23:32:43.411 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0003.xml
2010-06-17 23:32:43.411 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0004.xml
2010-06-17 23:32:43.411 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0005.xml
2010-06-17 23:32:43.411 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0006.xml
2010-06-17 23:32:43.412 XML2HTML[3626:a0f] file://localhost/Users/kingmtn/Downloads/T01/T01n0007.xml



seal 2010-11-12 14:27 发表评论
]]>
苏州破解华ؓHG522无线猫,使用iphone4上网http://m.tkk7.com/sealyu/archive/2010/11/05/337383.htmlsealsealFri, 05 Nov 2010 13:59:00 GMThttp://m.tkk7.com/sealyu/archive/2010/11/05/337383.htmlhttp://m.tkk7.com/sealyu/comments/337383.htmlhttp://m.tkk7.com/sealyu/archive/2010/11/05/337383.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/337383.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/337383.html

苏州我的e家用P图中VPC/VCI改ؓ8/35Q这Liphone输入wifi密码后就可以直接上网?br />


seal 2010-11-05 21:59 发表评论
]]>
AwakeFromNibhttp://m.tkk7.com/sealyu/archive/2010/10/28/336358.htmlsealsealThu, 28 Oct 2010 02:58:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/28/336358.htmlhttp://m.tkk7.com/sealyu/comments/336358.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/28/336358.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/336358.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/336358.html After all outlets and actions are connected, the nib loader sends awakeFromNib to every object in the nib. This is where you can access outlets to set up default values or do configuration in code. Example:

- (void)awakeFromNib
{
[buttonOutlet setPeriodicDelay:2 interval:0.5];
[textFieldOutlet setStringValue:@"Hello world!"];
}


seal 2010-10-28 10:58 发表评论
]]>
iphone 的cydia?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/10/18/335414.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/335414.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/10/18/335414.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/335414.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/335414.html</trackback:ping><description><![CDATA[<span style="color: #ff0000;"><strong>下面几个是我自己的所有ios机器上越狱必定会d的Cydia源,资源丰富Q当然最重要的是免费 </strong></span><strong><br /> <a target="_blank">http://cydia.hackulo.us/</a>                                                                         大名鼎鼎的Hackulo?资源不多Q但都几乎是必须?我的appsyncQInstallous{一般就在这里面q行安装 <br /> <a target="_blank">http://app.weiphone.com/cydia/</a>  (强烈推荐)                                      weiphone官方的Cydia源,更新很快Q资源非常多 <br /> <a target="_blank"><strong><font size="6">http://apt.178.com/</font></strong></a><strong> <span style="color: #ff0000;"> (重磅推荐)</span>       </strong> <br /> <strong>app破解?span style="color: #ff0000;">丛林?@Conglinlang) </span><span style="color: #000000;">的Cydia?诠释最C的中文Cydia源资源丰富且全部免费,,,更新快,速度?/span> </strong><br /> <br /> <a target="_blank">http://cydia.xsellize.com/</a>                                                                        国外知名破解软g源,资源丰富Q且免费(其中破解了很多bigboos中的收费目) <br /> <a target="_blank">http://www.sinfuliphonerepo.com</a>                                                       国外知名破解软g源,资源丰富Q且免费(其中破解了很多bigboos中的收费目) <br /> <a target="_blank">http://cy.sosiphone.com/</a>                                                                       国外知名破解软g源,资源丰富Q且免费(其中破解了很多bigboos中的收费目) <br /> <a target="_blank">http://iphone.t gbus.com/cydia/</a> (Lt和g中间的空?                                                            늎扒屎的Cydia源,资源丰富Q免贚w目多 <br /> <br /> <br /> <strong><span style="color: #ff0000;">以下几个为Cydia的自带源Q大安要特别注意千万别删除?万一不小心删除的话,可以在weiphone源中扑ֈweiphone新源Q安装对应镜像源卛_)Q?/span></strong> <br /> <a target="_blank">http://apt.modmyi.com/</a>  <br /> <a target="_blank">http://apt.bigboss.us.com/repofiles/cydia/</a>  <br /> <a target="_blank">http://apt.saurik.com/</a>  <br /> <a target="_blank">http://ispaziorepository.com</a>  <br /> <a target="_blank">http://repo.smxy.org/cydia/apt/</a>  <br /> <a target="_blank">http://www.zodttd.com/repo/cydia/</a> </strong> <img src ="http://m.tkk7.com/sealyu/aggbug/335414.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-10-18 10:01 <a href="http://m.tkk7.com/sealyu/archive/2010/10/18/335414.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Limera1n iOS 4.1&3.2.2狱教程Q{Q?/title><link>http://m.tkk7.com/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://m.tkk7.com/sealyu/archive/2010/10/11/334474.html</guid><wfw:comment>http://m.tkk7.com/sealyu/comments/334474.html</wfw:comment><comments>http://m.tkk7.com/sealyu/archive/2010/10/11/334474.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/sealyu/comments/commentRss/334474.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/sealyu/services/trackbacks/334474.html</trackback:ping><description><![CDATA[奇子Geohot的Limera1n<a >狱</a>工具现在正式攑և了。此ơ的Limera1n<a >狱</a>对?a >iPhone</a>/iPod touch/iPad三款pd讑֤Q可<a >狱</a>的iOS包括4.1以及3.2.2。另外即使是3.0或?.1的固Ӟ也可以通过Limera1nq行4.1?a >狱</a>。下面是Limera1n?a >狱</a>教程及必L意的事项Q之后如Limera1nq行更新Q也会q行教程的更新? <p>  <strong><font size="3"><font color="#ff0000">使用?a >狱</a>工具前请注意Q本工具只提?a >狱</a>而不提供解锁Q有锁版<a >iPhone</a>用户请勿使用Q以免造成不良的后果。而目前最新版的Limera1n 为Beta4Q主要更新支持MC型号?a >iPhone</a> 3GSQ新BootromQ,修复自n卸蝲及其他一些BUG。另外目前Limera1n暂时不支持iPod touch 2代的<a >狱</a>Q需要等Geohot试更新后才能支持。另外目前Limera1n仅支?/font><font color="#ff0000">Windowsq_Q?/font><font color="#ff0000">Mac、Linux或者其他^台的Limera1n需要等待更新才能支持?/font></font></strong></p> <p>  <strong>下面是Limera1n<a >狱</a>教程Q?/strong></p> <p>下蝲Limera1n Beta3Q进?a target="_blank"><font color="#0070af" size="4">http://limera1n.com/</font></a><span id="att_1265623">Q?strong><font color="#0000ff">如无法进入,请借助工具或者避开览高峰期进入?/font></strong></span></p> <p>  获得Limera1nQ接着?a >iPhone</a>/iPod touch/iPadq接到电脑,然后打开Limera1nQ见下图Q?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101418050.jpg" border="0" /></a></p> <p>  接着点击make in ra1nQ然后会出现下面q个界面Q提C?#8220;hold home+power”</p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101419140.jpg" border="0" /></a></p> <p>  按照提示按住<strong><font size="3">甉|?home?/font></strong>不要松手Q等待一会,出现新的提C:“Relase power button”</p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101421260.jpg" border="0" /></a></p> <p align="left">  q个时候按?font size="2"><strong>提示村ּ甉|键,但是home键请保持l箋按住的状?/strong></font>Q然后将会显C?#8220;in DFU mode...wait”Q进入了DFU模式Q见下图Q?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101422530.jpg" border="0" /></a></p> <p align="left">  q个时?a >iPhone</a>/iPod touch/iPad的屏q上会出现Limera1n的标志——一滴绿色的雨滴。接着误心{待一会,成功的话会出现以下的界面:</p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101425070.jpg" border="0" /></a></p> <p align="left">  Limera1n<a >狱</a>W一部分完成。接着重启讑֤Q然后在屏幕内找到Limera1n的图标点击进入?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101427580.png" border="0" /></a></p> <p align="left">  在Limera1n里面选择cydiaQ然后再点击右上角的“Install”Q开始进行cydia的下载。注意!此步骤需要无U网l支持?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101427330.png" border="0" /></a></p> <p align="left">  国外用户可直接下载,国内用户如无法下载的Q请讄讑֤内的VPN?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101429230.png" border="0" /></a></p> <p align="left">  cydia下蝲完成Q本ơLimera1n<a >狱</a>工作完成?/p> <p align="center"><a title="Limera1n iOS 4.1&3.2.2狱教程" ><img alt="" src="http://resource.weiphone.com/resource/h003/h44/img201010101437470.png" border="0" /></a></p> <p align="left">  <strong><font color="#ff0000"><a >狱</a>时及完成<a >狱</a>后的注意事项Q?/font></strong></p> <p align="left"><strong><font color="#ff0000">  1 <a >狱</a>的时候请打开iTunesQ?/font></strong></p> <p align="left"><strong><font color="#ff0000">  2 <a >狱</a>完成后请通过</font><font color="#ff0000">cydiaq行SHSH的备份。未备䆾SHSH的用P在Cydia的首会有一个红心标志,点击卛_备䆾。如已经备䆾q的Q则不会出现此标志,q且会在Cydia首页最上方昄“SHSH:iOS 4.1”Q表C此讑֤已经备䆾qSHSH?/font></strong></p> <p align="left"><strong><font color="#ff0000">  3 <a >狱</a>后如果limera1n和Cydia图标是白色的Q无需紧张Q重启设备即可?/font></strong></p> <p align="left"><font color="#ff0000"><strong>  4 <a >狱</a>后的ipa破解补丁安装Q请q入</strong></font></p> <p align="left"><font color="#ff0000">  <a ><strong>http://apt.weiphone.com/cydia</strong></a></font></p> <p align="left"><font color="#ff0000">  <a ><strong>http://app.weiphone.com/cydia/</strong></a></font></p> <p align="left"><font color="#ff0000">  <a ><strong>http://apt.weiphone.com/cydia/saurik</strong></a></font></p> <p align="left"><font color="#ff0000">  <a ><strong>http://apt.weiphone.com/cydia/bigboss</strong></a></font></p> <p align="left"><font color="#ff0000">  <a ><strong>http://cydia.hackulo.us</strong></a></font></p> <p align="left"><font color="#ff0000"><strong>  {源Q下载安装相应的ipa破解补丁?/strong></font></p> <img src ="http://m.tkk7.com/sealyu/aggbug/334474.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/sealyu/" target="_blank">seal</a> 2010-10-11 20:37 <a href="http://m.tkk7.com/sealyu/archive/2010/10/11/334474.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSHhttp://m.tkk7.com/sealyu/archive/2010/10/11/334472.htmlsealsealMon, 11 Oct 2010 12:14:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/11/334472.htmlhttp://m.tkk7.com/sealyu/comments/334472.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/11/334472.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/334472.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/334472.html  ECID SHSH备䆾工具TinyUmbrella卛_来的Firmware UmbrellaQ是一Ƅ来申请ECID配对的SHSH文g的YӞ支持未越q讑֤。最新版4.1.4支持iOS 4.1和iPhone4。此E序需要Javaq行环境支持Q如果没有安装,请到Java官方|站下蝲安装?/p>

TinyUmbrella 4.1.4下蝲

iTunes10下蝲

Javaq行环境下蝲


注意事项Q?/font>

  1.使用TinyUmbrella之前Q请卸蝲电脑上的Wi-Fi SyncQ如果以前安装过Q?/p>

  2.使用本地SHSH恢复q程中可能会有错误提C弹出,但不用担心,Zg的确可以完成恢复Q如果卡在DFU或黑屏模式无法退出,则可以用集成的Kick Device Out of RecoveryQ如下图Q?/strong>按钮来退出恢复模式?/p>

  3.Mac用户请将App拷备出DMG镜像再运行,否则会收到无的密码提示选项?/p>

  4.必须安装iTunes9.0或以上版本,推荐iTunes10?/p>


  软g的操作非常简单:

一、备份shsh

  先将iPhone联机Q点?strong>Save My SHSH开始备份?br /> SHSH文g的位|位于:
Windows XP     C:"Documents and Settings"用户?.shsh            
Windows   7 C:"Users"用户?.shsh"                          
Mac     /Users/用户?.shsh/                              

注意Q?br /> 1Q在Mac下面文g?shsh是隐藏的Q要xC,需在终端中输入Qdefaults write com.apple.finder AppleShowAllFiles -bool true命o后重启FinderQ恢复隐藏,则将true改ؓfalseQ重启finder?/p>

  2Q从Apple和Saurik取回的SHSH大小不同Q但是在恢复时没有媄响?/p>

二、自建服务器恢复Zg

  在第一步完成之后,
无需更改hostsQ?br /> 点击右上?strong>Start TSS Servicer后恢复SHSH对应Zg卛_?/p>


几点说明Q?/p>

  1.Save My SHSH按钮是备䆾SHSH的开兟뀂连接iDevice到电脑后Q打开TinyUmbrella后直接点L按钮卛_备䆾SHSH?/p>

  2.Start TSS Server按钮是在恢复Zg时用的Q按下后卛_使用本地的SHSH文g来恢复iPhoneZg?/p>

  3.Display SHSHs按钮是用来显C备是否有相应的SHSH可以下蝲或者用,效果如下Q?/p>

  4.Advanced OptionsN后会出现ECID、Device/Version和Location三个选项Q第一个ECID处可以手动输入ECID码;W二 Device/Version用来强制选择型号和版本;W三个Location是选择SHSH的备份地址Q这个要重点介绍一下,选择Apple是从Ҏ? 份、选择Cydia则是在Cydia中备份、选择Local是备份到本地。没有在本地看到SHSH文g的用户不用担心,默认的备份用Cydia服务器?/p>


当TinyUmbrella无法识别已经q接到电脑的iPhone、iPad或者iPod touchӞ׃能一键备份SHSH了,首先需?a title="使用USBView来查看iPhone的ECID" target="_blank">使用USBView来查看iPhone的ECIDQ也可?a title="ECIDd? target="_blank">ECIDd?/a>或?a title="Auto SHSH Grabber" target="_blank">Auto SHSH GrabberQ选择一U习惯的Ҏ卛_Q不需要每U方法都会)。这里我们用最可靠的USBView?

不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

首先Q按住HOME和Power键十U左叻IiPhone屏幕黑掉Q之后读五秒Q保持Home键按住ƈ村ּPowerQ当打开的iTunes出现上图中的反映时松开所有按键?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

此时Q应该有q样的提C?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

q行USBViewQ点M面的Options?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

按图中选中Config Description?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

之后按F5hQ可以看C个处于DFU模式的iPhone?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

q时Q在右侧可以扑ֈ对应的ECID和iBoot版本?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

打开TinyUmbrellaq将ECID填入Advanced Options中的ECID框内?br />

随后Q没有越p的iPhone需要把Request From一w择为AppleQ然后点击Save My SHSH按键开始保存相应版本的SHSH。(狱q备份过4.1SHSH的用户可以直接选择Cydia来保存SHSHQ?br />
不越qTinyUmbrella4.1.4备䆾iOS4.1的SHSH

恢复Zg时打开TSS Server选项Q这时会自动杀掉iTunesQ重新打开后即可正常恢复?/p>

seal 2010-10-11 20:14 发表评论
]]>
Helper class for showing records with pagination for iPhone sdk apphttp://m.tkk7.com/sealyu/archive/2010/10/08/334004.htmlsealsealFri, 08 Oct 2010 13:30:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/08/334004.htmlhttp://m.tkk7.com/sealyu/comments/334004.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/08/334004.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/334004.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/334004.htmlWe 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
with pagination with buttons like next, previous etc.

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.

I have created a class named PaginationAgent. After loading records it calls related methods of its delegate which should implement protocol PaginationAgentDeleagte.

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

  • get_total_number_of_records.php
  • get_records.php

Lets see an example.

First, I have created a simple view based project “Pagination” and designed the view as u see:

Create a similar view using Interface Builder

1. Added a button to show previous page data

2. One button to reload the data.

3. Another to show data on next page.

4. Added a UITable which will show the result.

In PaginationViewController.h, imported PaginationAgent.h file and declared:

  1. PaginationAgent* objPagination;  

Now lets see how to initialize it. In the viewDidLoad method I initialized this like this:

  1. objPagination = [[PaginationAgent alloc] init];  
  2. objPagination.delegate = self;  
  3. objPagination.remoteApiBasePath = @"http://your.server/path/to/folder";  

remoteApiBasePath must be set to the location where the server side php files are placed.
No trailing slash.

PaginationAgentDelegate protocol declares the following functions to be overridden by the Delegate:

  1. /** 
  2. * This method is called when the busystate is changed. 
  3. * You can do something like disable/enable the buttons, grayout etc 
  4. * based on the isBusy value. 
  5. */  
  6. -(void)paginationAgent:(PaginationAgent*)agent updateBusyMode:(BOOL)isBusy;  
  7.   
  8. /** 
  9. * Called when total data count is received if shouldReloadAtFirstPage is set NO. 
  10. */  
  11. -(void)paginationAgent:(PaginationAgent*)agent totalDataCountReceived:(int)dataCount;  
  12.   
  13. /** 
  14. * Called when page data is loaded. You may set your table dataSource here and realod 
  15. * reload the table. 
  16. */  
  17. -(void)paginationAgent:(PaginationAgent*)agent pageDataReceived:(NSArray*)data;  
  18.   
  19. /** 
  20. * Called if server sends malformed data 
  21. */  
  22. -(void)paginationAgent:(PaginationAgent*)agent onPaginationServerError:(NSString*)message;  
  23.   
  24. /** 
  25. * Called if connection failed. It may occur due to poor or no internet connectivity 
  26. */  
  27. -(void)paginationAgent:(PaginationAgent*)agent onPaginationConnectionError:(NSString*)message;  

The php files must return data in json format and must use the format as used:

  1. 1,'message'=>'Success','data'=>33);  
  2.     echo json_encode($data);  
  3.   
  4. ?>  
  1. ...  
  2. ...  
  3. $data = array('success'=>1,'message'=>'Got data','data'=>$rows);  
  4.   
  5. echo json_encode($data);  

See the attached project for details. The php files are inside the folder “PHPFILES”.

Pagination.zip



seal 2010-10-08 21:30 发表评论
]]>
How To Integrate iAd into Your iPhone Apphttp://m.tkk7.com/sealyu/archive/2010/10/08/333984.htmlsealsealFri, 08 Oct 2010 08:35:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/08/333984.htmlhttp://m.tkk7.com/sealyu/comments/333984.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/08/333984.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333984.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333984.htmlHow To Integrate iAd into Your iPhone App

1) Integrate iAd 2) ??? 3) PROFIT!

1) Integrate iAd 2) ??? 3) PROFIT!

With the iOs SDK 4 now public and the advent of iAds just a few days away, I thought we’d celebrate with a tutorial on how to integrate iAd into your iPhone app!

In this tutorial, not only will we show you how to get started with iAd, but we’ll also show you how to deal with some complex issues you may run into along the way such as:

  • Supporting both Portrait and Landscape ads in the same app
  • Integrating into a Universal app
  • Maintaining backwards compatibility with iOs 3.0
  • What to do if you are using a UITableViewController!

We’re actually going to start with where we left off in the How To Port an iPhone Application to the iPad and use the universal app we developed in that tutorial in the starting point.

So grab a copy if you haven’t already, and let’s get to adding some iAds!

Base SDK vs. Deployment Target

The first step to use iAd is to make sure our project has the right Base SDK and iPhone OS Deployment Target selected.

For those of you confused about the difference between the Base SDK and Deployment Target (like I was for quite some time!), here’s what they mean:

  • The Base SDK 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 – as long as they are available on the actual device the code runs on.
  • The Deployment Target is the earliest possible version of the SDK your code can run on. This can be an earlier version than the Base SDK – 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!

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’s available, but still work on the old version of the OS if it isn’t. We already did some of this in How To Port an iPhone Application to the iPad, and we’ll do even more in this tutorial!

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+).

So first let’s set iOs 4.0 as the base SDK. To do this, expand the Targets directory, right click on PortMe, and choose “Get Info”. Click the Build tab, make sure “All Configurations” is selected, navigate to Architectures\Base SDK, and change the value to iPhone Device 4.0.

Screenshot of Setting Base SDK

Then, let’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.

Screenshot of setting Deployment Target

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’ll know it’s working!

Screenshot of PortMe on iOS4

Linking Against the iAd Framework

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 “Add\Existing Frameworks…”, and choosing “iAd.framework”.

The problem is, if that is all we do our code will break on older devices that don’t have the iAd framework.

You can verify this by trying to run your code in the iPad Simulator 3.2 – boom! The app will crash on startup and you’ll see the following error log:

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

To fix this, we need to weak link against the iAd framework. Expand the Targets directory, right click on PortMe, and choose “Get Info”. Click the Build tab, make sure “All Configurations” is selected, and navigate to Linking\Other Linker Flags. Double click on that entry, click the “+” button, and type “-weak_framework iAd”.

Click OK, and then try your app on the iPad simulator again and viola – it should work!

Preparing our XIB

In this tutorial, we’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’re going to start there first.

Open up PortMeGameDetailsController.xib. You’ll see that all of the controls are children of a single view:

Details View Controller Settings - Before

What we’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’t that easy because all of the controls are direct children of the root view. But there’s an easy way to fix it – we’ll simply move the controls into a subview instead!

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’s size (320×416). Then drag the existing view as a subview of the new view. When you’re done, it should look like the following:

Details View Controller Settings - After

Then, control-drag from the File’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’re one step closer to integrating iAd!

Simple iAd Integration

Ok, now let’s get to the fun part – integrating iAd!

First, make the following changes to PortMeGameDetailsController:

// In the import section
            #import "iAd/ADBannerView.h"
             
            // Modify the PortMeGameDetailsController interface
            @interface PortMeGameDetailsController : UIViewController
            <GameSelectionDelegate, UISplitViewControllerDelegate, ADBannerViewDelegate> {
             
            // Inside the PortMeGameDetailsController interface
            UIView *_contentView;
            id _adBannerView;
            BOOL _adBannerViewIsVisible;
             
            // After the interface
            @property (nonatomic, retain) IBOutlet UIView *contentView;
            @property (nonatomic, retain) id adBannerView;
            @property (nonatomic) BOOL adBannerViewIsVisible;

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.

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’s currently visible.

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.

Before we forget, let’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’s Owner to the inner (second) UIView, and connect it to the contentView outlet.

Then switch over to PortMeGameDetailsController.m and make the following changes:

// In the synthesize section
            @synthesize contentView = _contentView;
            @synthesize adBannerView = _adBannerView;
            @synthesize adBannerViewIsVisible = _adBannerViewIsVisible;
             
            // In the dealloc section
            self.contentView = nil;
            self.adBannerView = nil;

Next, we’re going to add the meat of the code. But there’s a lot of it – so let’s break it down into 6 steps.

1) Add helper functions to get height of iAd banner

- (int)getBannerHeight:(UIDeviceOrientation)orientation {
            if (UIInterfaceOrientationIsLandscape(orientation)) {
            return 32;
            } else {
            return 50;
            }
            }
             
            - (int)getBannerHeight {
            return [self getBannerHeight:[UIDevice currentDevice].orientation];
            }

There are several places in the rest of the code where we’re going to want to know how large the banner view should be given a particular orientation. Currently iAds have two possible sizes: 320×50 for landscape, or 480×32 for portrait. So we simply retrieve the proper height based on the passed in orientation.

2) Add helper function to create the iAd view

- (void)createAdBannerView {
            Class classAdBannerView = NSClassFromString(@"ADBannerView");
            if (classAdBannerView != nil) {
            self.adBannerView = [[[classAdBannerView alloc]
            initWithFrame:CGRectZero] autorelease];
            [_adBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:
            ADBannerContentSizeIdentifier320x50,
            ADBannerContentSizeIdentifier480x32, nil]];
            if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
            [_adBannerView setCurrentContentSizeIdentifier:
            ADBannerContentSizeIdentifier480x32];
            } else {
            [_adBannerView setCurrentContentSizeIdentifier:
            ADBannerContentSizeIdentifier320x50];
            }
            [_adBannerView setFrame:CGRectOffset([_adBannerView frame], 0,
            -[self getBannerHeight])];
            [_adBannerView setDelegate:self];
             
            [self.view addSubview:_adBannerView];
            }
            }

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 – if it is not, the method will return nil and the function will bail.

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.

It then calls setCurrentContentSizeIdentifier to tell iAd which ad it should display. We simply choose the correct one by looking at the current orientation.

Next, we need to set the frame for the iAd. Note there’s some funky business here – we actually set the frame of the view to be offscreen! This is because we don’t know if an ad is available yet, and we don’t want to display the view until we know one is.

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!

Note something subtle about the above – we always use message passing syntax rather than dot notation (i.e. [_adBannerView setRequiredContentSizeIdentifiers:...] instead of _adBannerView.requiredContentSizeIdentifiers = …). This is again to make sure everything runs fine on OS 3.0+.

3) Add function to size views correctly

- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
            if (_adBannerView != nil) {
            if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
            [_adBannerView setCurrentContentSizeIdentifier:
            ADBannerContentSizeIdentifier480x32];
            } else {
            [_adBannerView setCurrentContentSizeIdentifier:
            ADBannerContentSizeIdentifier320x50];
            }
            [UIView beginAnimations:@"fixupViews" context:nil];
            if (_adBannerViewIsVisible) {
            CGRect adBannerViewFrame = [_adBannerView frame];
            adBannerViewFrame.origin.x = 0;
            adBannerViewFrame.origin.y = 0;
            [_adBannerView setFrame:adBannerViewFrame];
            CGRect contentViewFrame = _contentView.frame;
            contentViewFrame.origin.y =
            [self getBannerHeight:toInterfaceOrientation];
            contentViewFrame.size.height = self.view.frame.size.height -
            [self getBannerHeight:toInterfaceOrientation];
            _contentView.frame = contentViewFrame;
            } else {
            CGRect adBannerViewFrame = [_adBannerView frame];
            adBannerViewFrame.origin.x = 0;
            adBannerViewFrame.origin.y =
            -[self getBannerHeight:toInterfaceOrientation];
            [_adBannerView setFrame:adBannerViewFrame];
            CGRect contentViewFrame = _contentView.frame;
            contentViewFrame.origin.y = 0;
            contentViewFrame.size.height = self.view.frame.size.height;
            _contentView.frame = contentViewFrame;
            }
            [UIView commitAnimations];
            }
            }

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.

And that’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.

4) Call createAdView in viewDidLoad

- (void)viewDidLoad {
            [self createAdBannerView];
            }

We want to create our ad view as soon as our view is loaded, even if we aren’t ready to display it quite yet.

5) Call fixupAdView in viewWillAppear and willRotateToInterfaceOrientation

- (void) viewWillAppear:(BOOL)animated {
            [self refresh];
            [self fixupAdView:[UIDevice currentDevice].orientation];
            }
             
            - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
            [self fixupAdView:toInterfaceOrientation];
            }

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!

6) Implement ADBannerViewDelegate

#pragma mark ADBannerViewDelegate
             
            - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
            if (!_adBannerViewIsVisible) {
            _adBannerViewIsVisible = YES;
            [self fixupAdView:[UIDevice currentDevice].orientation];
            }
            }
             
            - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
            {
            if (_adBannerViewIsVisible)
            {
            _adBannerViewIsVisible = NO;
            [self fixupAdView:[UIDevice currentDevice].orientation];
            }
            }

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.

Done!

And that’s it! Compile and run your project, and you should see ads appear correctly in both portrait and landscape mode.

iAd in List View - Portrait Mode

iAd in List View - Landscape Mode

And best yet – if you run the code on an iPad or iPhone 3.0 device it will work just fine as well, but without ads!

UITableView integration

Well that worked great for our details controller, but we want it in our list controller too!

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:

1) Create a XIB for PortMeGameListController

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.

Open up the XIB, click on the File’s Owner, and in the fourth tab of the Attributes Inspector change the class to PortMeGameListController.

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’re done it should look like this:

XIB settings for PortMe's List View Controller

2) Make some changes to PortMeGameListController

Inside PortMeGameListController.h:

// Change the interface declaration
            @interface PortMeGameListController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
             
            // Add inside class
            UITableView *_tableView;
            UIView *_contentView;
             
            // Add after class
            @property (nonatomic, retain) IBOutlet UITableView *tableView;
            @property (nonatomic, retain) IBOutlet UIView *contentView;

Inside PortMeGameListController.m:

// In synthesize section
            @synthesize tableView = _tableView;
            @synthesize contentView = _contentView;
             
            // In dealloc section
            self.tableView = nil;
            self.contentView = nil;

Don’t forget to save the files!

3) Hook up outlets

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.

Also control-drag from the tableView back to the File’s Owner and set it as the delegate and datasource.

4) Set the NIB name for PortMeGameListController in MainWindow

Open MainWindow.xib and MainWindow-iPad.xib, expand the Navigation Controller, select “Port Me Game List Controller”, and change the nib name to PortMeGameListController.

5) Compile and test to make sure everything works as usual

At this point, compile and run your code and make sure everything works as it usually does – but now you’re using a UIViewController rather than a TableViewController, and you have a XIB laid out in a nice way to use iAds!

6) Follow the steps from the previous section

Now you’re exactly where we were in the previous section with a view controller – so follow the same steps to integrate in this view!

Done!

If all goes well, you should be able to compile and run your project and see advertisements at the top of your table view!

iAd in Table View - Portrait Mode

iAd in Table View - Landscape Mode

Where To Go Now?

Here is a sample project with all of the code we’ve developed in the above tutorial.

Now you should know how to integrate iAds into your projects – no matter what OSs you wish to support for your app! I’d love to hear your experiences with iAds and how well they are working (or not) for your app!



seal 2010-10-08 16:35 发表评论
]]>
iPhone讄视图背景囄的方??http://m.tkk7.com/sealyu/archive/2010/10/08/333982.htmlsealsealFri, 08 Oct 2010 08:04:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/08/333982.htmlhttp://m.tkk7.com/sealyu/comments/333982.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/08/333982.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333982.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333982.html
Objective-c代码
  1. - (void)setBackgroundImage {  
  2.     NSLog(@"setting bg image");  
  3.     UIImageView *customBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.jpg"]];  
  4.     self.background = customBackground;  
  5.     [customBackground release];  
  6.       
  7.     [self addSubview:background];  
  8.     NSLog(@"Added background subview %@", background);  
  9.     [self sendSubviewToBack:background];  
  10. }  


Ҏ二,Cook Book中提到的Ҏ

Objective-c代码
  1. - (void)loadView {  
  2.       
  3.     UIImageView *contentView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];  
  4.     [contentView setImage:[UIImage imageNamed:@"Default.png"]];  
  5.     [contentView setUserInteractionEnabled:YES];  
  6.     self.view = contentView;  
  7.     [contentView release];  
  8. }  


Ҏ三,lvyile|友用的一个小技巧,uiView是UIView的实例,而不是UIImageView

Objective-c代码
  1. uiView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Default.png"]]; 


seal 2010-10-08 16:04 发表评论
]]>
How To Make Ultra-Slick Gradient UITableView Cellshttp://m.tkk7.com/sealyu/archive/2010/10/08/333958.htmlsealsealFri, 08 Oct 2010 03:02:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/08/333958.htmlhttp://m.tkk7.com/sealyu/comments/333958.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/08/333958.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333958.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333958.htmlEditor’s Note: You’ve seen the slick supercool gradient UITableView backgrounds, and this is how to make them quick and easy.  Thanks to Brett Romero of Cygen for this tutorial, ManiacDev.Com’s first submitted tutorial.  If you’ve created a quality, original tutorial that you think iPhone developers might want to read about please e-mail webmaster@maniacdev.com.
- Johann Dowa, ManiacDev.Com
 
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.

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.
The finished product is shown below.

 

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.

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:

  • Width: 80 pixels
  • Height: 40 pixels
  • Background Contents: Transparent

Select a foreground color from the toolbar, as shown below:

 

 

Now select the gradient button, as shown below:

 

 

With the gradient selected, swipe from bottom to top on your image. This should produce a gradient color. Now choose File and “Save for Web”. You’ve just created the image we’ll use in our tableview. Let’s switch over to Xcode and implement the image.

In Xcode, we start by creating a navigation based application.

Once the application has been created, add the newly created image by right clicking the Resources folder then “Add” and “Existing Files”, as shown below:

 

 

 

 

The following code snippet creates two views. Both are then added to the cell’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:

 

 

From the screenshot, you can see the cell’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.

Let’s take a look at the implementation in Xcode, which is all done in the UITableView delegate method cellForRowAtIndexPath:.

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;

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’s background view. The backgroundView will retain an instance of the imageView. Therefore, we release our instance, as follows:

[imageView release];

If we had not released our instance, we’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’s size to cover the entire cell. The label’s background is set to clear or transparent so it doesn’t hide the cell’s background image. Our assigned text is centered and finally, we add the label to the cell’s view, making it the top most view in the cell.



seal 2010-10-08 11:02 发表评论
]]>
Changing UITableView widthhttp://m.tkk7.com/sealyu/archive/2010/10/08/333955.htmlsealsealFri, 08 Oct 2010 02:40:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/08/333955.htmlhttp://m.tkk7.com/sealyu/comments/333955.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/08/333955.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333955.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333955.htmlI’m back to programming and currently developing application for iPad. I needed something, what looked like a simplest thing – UITableView taking a portion of screen and SplitViewController wasn’t attractive option. To my surprise non of the obvious to me solutions worked until I’ve tried not-so-elegant reallocating of tableView.

So, in myTableViewController I created custom init function:

- (id) initWithFrame:(CGRect)frm {
if ((self = [super initWithStyle: UITableViewStylePlain])){
self.tableView = [[UITableView alloc] initWithFrame:frm style:UITableViewStylePlain];
}
return self;
}

Obviously, you can use default or your own init function or avoid passing frame argument and hardcode dimensions right here, but the magical line is:

self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, y, width, height) style:UITableViewStylePlain];

Well, at least it worked for me.



seal 2010-10-08 10:40 发表评论
]]>
iPhone Programming: Set UITableView Accessory Arrow Stylehttp://m.tkk7.com/sealyu/archive/2010/10/07/333915.htmlsealsealThu, 07 Oct 2010 12:21:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/07/333915.htmlhttp://m.tkk7.com/sealyu/comments/333915.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/07/333915.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333915.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333915.htmlThe 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.


At this point, you need to have a working UITableView-based application. If you aren’t at this point, you’ll need to take a few steps back and check with the official Apple iPhone SDK documentation.

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:

- (UITableViewCellAccessoryType)tableView:(UITableView *)tv accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
{
   return UITableViewCellAccessoryDetailDisclosureButton;
}

Yeah, that’s a keyboard-full, but it’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.

If you don’t want to show the accessory image for every cell in the table, you’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.

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.

Disclosure indicator

UITableViewCellAccessoryDisclosureIndicator
Used to indicate that tapping the cell will slide in a new table view one level down in the hierarchy.


Detail disclosure button

UITableViewCellAccessoryDetailDisclosureButton
This button indicates that tapping the cell will reveal a detail view of that item.


Checkmark

UITableViewCellAccessoryCheckmark
Indicates that a row has been selected by the user.


Nothing

UITableViewCellAccessoryNone
This is the default value for the cell accessory indicating that no accessory should be shown.

This isn’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.



seal 2010-10-07 20:21 发表评论
]]>
Easy custom UITableView drawinghttp://m.tkk7.com/sealyu/archive/2010/10/07/333863.htmlsealsealThu, 07 Oct 2010 04:35:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/07/333863.htmlhttp://m.tkk7.com/sealyu/comments/333863.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/07/333863.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333863.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333863.html

It is really easy to customize your UITableViews. I'll show you how to completely customize the appearance of UITableViews without overriding or subclassing and without the need for any tricky hackery.

Make my table pretty

The core of most iPhone applications is the UITableView. To make your iPhone application stand out, the simplest way is to make your UITableView look good.

Customizing your UITableView 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.

The sample application

The approach I'll show you will turn the table on the left into the table on the right:

customtableview.png

Left: a default UITableView with three rows. Right: the same table view after customization.

How to fail at UITableView customizing

Coming from Mac OS X made it harder for me ?UITableView needs to be customized in a very particular way and structurally, it is very different to Mac OS X's NSTableView and NSCell drawing.

The following are all really bad ways to customize a table (even though you can make it work):

  • Subclassing UITableView to customize drawing
  • Subclassing UITableViewCell to customize drawing
  • Creating your own array of UITableViewCells and returning these instead of using dequeueReusableCellWithIdentifier:

About the second point: it is okay to customize UITableViewCell ?but you shouldn't really use it for drawing. The UITableViewCell class is more of a controller class ?it handles behaviors and layout, not drawing. You can customize UITableViewCell to load a specific contentView (and do the custom drawing there).

That last point (that you should always use dequeueReusableCellWithIdentifier:) is only peripherally related to drawing but it will significantly slow your drawing down if you avoid the normal cell queuing architecture.

How to succeed at UITableView customizing

There are only a few points to understand related to table drawing.

First: the UITableView does not itself draw anything except the background. To customize the background of a UITableView, all you need to do is set its backgroundColor to [UIColor clearColor] and you can draw your own background in a view behind the UITableView.

Second: The tableHeaderView (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.

Third: UITableViewCell is composed of 5 different subviews. Customizing the right subview is the secret to good UITableViewCell drawing. The subviews are:

  1. backgroundView ?the entire background of the row (including what looks like the UITableView's background in UITableViewStyleGrouped style tables.
  2. selectedBackgroundView ?replaces the backgroundView when the row is selected.
  3. image ?a customizable image (not actually a subview) at the left of the cell.
  4. accessoryView ?a customizable view at the right of the cell.
  5. contentView ?a customizable view between the image and the accessoryView (technically, it extends behind the image).

You can customize any of these (except image which must be a UIImage) using your own custom drawn views.

However, since the pixel size of the table never changes, it is often easiest just to use UIImageViews 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 UIImage's named image cache manage your memory for you.

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.

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 UIImageView to draw your views in a table.

Implementation

With all custom drawing handled by UIImageView, that still leaves some work to do. You must handle all layout and configuring of views.

Configuration of the UITableView and layout of the table header

As an example of what that means, have a look at the viewDidLoad method for this post:

- (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;
}

This method handles the configuration of the tableView (setting the backgroundColor, rowHeight and sets an image behind the table) but also creates its own layout for the table header.

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 UITableViewDelegate method tableView:viewForHeaderInSection:. There are equivalent properties and methods for the table and section footers.

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.

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 headerLabel that looks balanced in the view.

Cell backgrounds

The cell background needs to incorporate the tops and bottoms of table "sections". For this reason, the backgroundView and selectedBackgroundView normally need to be set on a row-by-row basis.

In your tableView:cellForRowAtIndexPath: method where you are configuring the cell for a given row, this code will handle that behavior:

UIImage *rowBackground;
UIImage *selectionBackground;
NSInteger sectionRows = [aTableView numberOfRowsInSection:[indexPath section]];
NSInteger row = [indexPath row];
if (row == 0 && 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;
Layout within the contentView

Layout of elements within the contentView need only be set on construction of the contentView (not on a row-by-row basis).

Sadly, laying out UILabels in the contentView (like the "Cell at row X." and "Some other infomation." lables in this example) is a little verbose.

The following code is run immediately after the allocation of the UITableViewCell to position the "Cell at row X." label:

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];

In my mind, it seems like there should be a more efficient way to do this. I hold out the possibility that there is.

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 accessoryView, middle of the row but above the "Some other information." label.

Other adornments

The accessoryView is just a UIImageView. The cell.image is set as a property. These are extremely simple additions but they make the table cells far more impactful.

Conclusion

You can download the EasyCustomTable project as a zip file (60kb).

The code includes a #define at the top that allows you to toggle the custom drawing on and off.

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.

This does require custom images. If you've never drawn anything, now is a good time to learn inkscape (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.

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 nib2objc 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).



seal 2010-10-07 12:35 发表评论
]]>
Objective-C ?Convert NSString to int and Vice Versahttp://m.tkk7.com/sealyu/archive/2010/10/05/333773.htmlsealsealTue, 05 Oct 2010 13:01:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/05/333773.htmlhttp://m.tkk7.com/sealyu/comments/333773.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/05/333773.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333773.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333773.htmlConvert NSString to int

1 NSString *aNumberString = @"123";
2 int i = [aNumberString intValue];

 

Convert int to NSString

1 int aNumber = 123;
2 NSString *aString = [NSString stringWithFormat:@"%d", aNumber];



seal 2010-10-05 21:01 发表评论
]]>
How to Use UIDatePicker From UIKit in iPhone Programminghttp://m.tkk7.com/sealyu/archive/2010/10/04/333744.htmlsealsealMon, 04 Oct 2010 14:26:00 GMThttp://m.tkk7.com/sealyu/archive/2010/10/04/333744.htmlhttp://m.tkk7.com/sealyu/comments/333744.htmlhttp://m.tkk7.com/sealyu/archive/2010/10/04/333744.html#Feedback0http://m.tkk7.com/sealyu/comments/commentRss/333744.htmlhttp://m.tkk7.com/sealyu/services/trackbacks/333744.htmlHere is a great way to ask your users to input dates on your iPhone app.

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.

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:

Here is the code from the example:

Implement the UIDatePickerView Delegate

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:

#import <UIKit/UIKit.h>
//UIPicker requires an object that adopts the UIPickerViewDelegate protocol
@interface DatePicker : UIViewController<UIPickerViewDelegate> {
}
@end

Add the UILabel and UIDatePicker Objects

This part is straightforward enough: you essentially create a label and a date picker and add them both to the view controller’s subview collection. This is the typical pattern used to build up a view in code.

#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

Implement Your Action Method

This is the method that you assigned to the UIControlEventValueChanged event above using the target-action pattern.

- (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];
}

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.

Time To Take Action!

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.

Let us know how it goes in the comments below!



seal 2010-10-04 22:26 发表评论
]]>
վ֩ģ壺 ҹˬˬˬWWWƵʮ˽| Ļ1515hhþ| һëƬѲ| ޾ƷƬ| Ů18ëƬˮѲ| ձþһva| ߹ۿĶ | һػaƬ| ۺ| ˳ɵӰ߹ۿ| ۺ| ߹ۿƵվɫ| ޾ƷƵ| 5gӰԺ5gˬӰԺ| ˳վ| ڵƵ| ޳߲va| ˳ŷþ| ѳߵӰ| mvƷmvձmv| һ߹ۿ| ޹Ʒվ߲| aػƵƬƵ| CAOPORMƷƵ| AV˾Ʒ߹ۿ | պѹۿһëƬ| պ߹ۿƵ| Ļߵ| 91Ƶѹۿ| լоƷһ߹ۿ| ޳avƬۿ| ƷڵƵ| ۾ƷҹӰ| ӰԺ߹ۿ| caopornѹ| žžƵ| ëƬav߲һ| 97Ƶ| ɫ͵͵˵ | 97߹ۿƵ| ޹պһ|