﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>花太香齐的博客</title>
	<atom:link href="http://www.ieliwb.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ieliwb.com</link>
	<description>灵感的来临，没有任何预兆；灵感的消失，也不会有告别仪式；用文字记下她们吧，让灵感永存……</description>
	<lastBuildDate>Sun, 21 Nov 2010 03:36:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>我常用的几个提高iOS开发效率的开源类库及工具</title>
		<link>http://www.ieliwb.com/ios-framework-tools/</link>
		<comments>http://www.ieliwb.com/ios-framework-tools/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 02:58:46 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[心情随笔/生活感悟]]></category>
		<category><![CDATA[APP开发类库]]></category>
		<category><![CDATA[ios]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/%e6%88%91%e5%b8%b8%e7%94%a8%e7%9a%84%e5%87%a0%e4%b8%aa%e6%8f%90%e9%ab%98ios%e5%bc%80%e5%8f%91%e6%95%88%e7%8e%87%e7%9a%84%e5%bc%80%e6%ba%90%e7%b1%bb%e5%ba%93%e5%8f%8a%e5%b7%a5%e5%85%b7/</guid>
		<description><![CDATA[<p><strong>几个常用的开源类库及下载地址:</strong></p>
<blockquote><p>
1.<a href="http://code.google.com/p/json-framework">json</a> json编码解码<br />
2.<a href="http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/?r=87">GTMBase64</a> base64编码解码<br />
3.<a href="https://github.com/schwa/TouchXML">TouchXML</a> xml解析<br />
4.<a href="https://github.com/ldandersen/scifihifi-iphone">SFHFKeychainUtils</a> 安全保存用户密码到keychain中<br />
5.<a href="https://github.com/jdg/MBProgressHUD">MBProgressHUD</a> 很棒的一个加载等待特效框架<br />
6.<a href="http://allseeing-i.com/ASIHTTPRequest">ASIHTT[......]</a></p></blockquote><p class='read-more'><a href='http://www.ieliwb.com/ios-framework-tools/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>几个常用的开源类库及下载地址:</strong></p>
<blockquote><p>
1.<a href="http://code.google.com/p/json-framework">json</a> json编码解码<br />
2.<a href="http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/?r=87">GTMBase64</a> base64编码解码<br />
3.<a href="https://github.com/schwa/TouchXML">TouchXML</a> xml解析<br />
4.<a href="https://github.com/ldandersen/scifihifi-iphone">SFHFKeychainUtils</a> 安全保存用户密码到keychain中<br />
5.<a href="https://github.com/jdg/MBProgressHUD">MBProgressHUD</a> 很棒的一个加载等待特效框架<br />
6.<a href="http://allseeing-i.com/ASIHTTPRequest">ASIHTTPRequest</a> http等相关协议封装<br />
7.<a href="https://github.com/enormego/EGOTableViewPullRefresh">EGORefreshTableHeaderView</a> 下拉刷新代码<br />
8.<a href="http://www.markj.net/iphone-asynchronous-table-image/">AsyncImageView</a> 异步加载图片并缓存代码<br />
9.<a href="http://blog.blackwhale.at/">类似setting的竖立也分栏程序</a>
</p></blockquote>
<p><strong>AppStore软件排名相关,工欲善其事，必先利其器。</strong></p>
<blockquote><p>
1.下载排名相关:<a href="http://www.appannie.com/">appannie</a><br />
2.用户行为分析:<a href="http://www.flurry.com/">flurry</a><br />
3.<a href="http://majicjungle.com/majicrank.html">majicrank</a>-各国排名查询工具<br />
4.<a href="http://www.cocoachina.com/appstore/sales/2010/0331/890.html">AppViz</a>-App销售统计软件<br />
5.<a href="http://www.ideaswarm.com/products/appviz/">PodViz</a>-用户评论等查看工具<br />
6.<a href="https://www.appfigures.com/">appfigures</a>-报表统计分析工具<br />
7.我成立的一个帮助开发者推广app的评测站:<a href="http://www.ipadown.com">苹果I派党</a>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/ios-framework-tools/feed/</wfw:commentRss>
		<slash:comments>1083</slash:comments>
		</item>
		<item>
		<title>移动开发大趋势?</title>
		<link>http://www.ieliwb.com/mobile-dev/</link>
		<comments>http://www.ieliwb.com/mobile-dev/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 09:03:44 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[心情随笔/生活感悟]]></category>
		<category><![CDATA[移动开发]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/%e7%a7%bb%e5%8a%a8%e5%bc%80%e5%8f%91%e5%a4%a7%e8%b6%8b%e5%8a%bf/</guid>
		<description><![CDATA[<p>以下内容纯属个人瞎扯:<br />
对公司:<br />
短期投资iphone,<br />
中期投资做Android,<br />
估计未来应该是html5的天下了.</p>
<blockquote><p>Zynga刚刚收购了HTML5游戏引擎公司Dextrose AG ,可以预计明年的HTML5应用将飞速增加<br />
开发者使用HTML5的优势是可以将游戏编码移植到多个平台
</p></blockquote>
<p>对个人开发[......]</p><p class='read-more'><a href='http://www.ieliwb.com/mobile-dev/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>以下内容纯属个人瞎扯:<br />
对公司:<br />
短期投资iphone,<br />
中期投资做Android,<br />
估计未来应该是html5的天下了.</p>
<blockquote><p>Zynga刚刚收购了HTML5游戏引擎公司Dextrose AG ,可以预计明年的HTML5应用将飞速增加<br />
开发者使用HTML5的优势是可以将游戏编码移植到多个平台
</p></blockquote>
<p>对个人开发者而言:<br />
短期做iphone赚钱,赚了钱再投入到Android或html5上面去.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/mobile-dev/feed/</wfw:commentRss>
		<slash:comments>1174</slash:comments>
		</item>
		<item>
		<title>appstore中国区改版,偶的生活查询获首页推荐</title>
		<link>http://www.ieliwb.com/itool-appstore-new-commend/</link>
		<comments>http://www.ieliwb.com/itool-appstore-new-commend/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 08:51:11 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[心情随笔/生活感悟]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[生活查询]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/appstore%e4%b8%ad%e5%9b%bd%e5%8c%ba%e6%94%b9%e7%89%88%e5%81%b6%e7%9a%84%e7%94%9f%e6%b4%bb%e6%9f%a5%e8%af%a2%e8%8e%b7%e9%a6%96%e9%a1%b5%e6%8e%a8%e8%8d%90/</guid>
		<description><![CDATA[<p>好久没更新博客了.最近太忙了,进度很不顺.唯一感到欣慰的是产品获得认可,被苹果邀了宣传画,可惜最后没有上推荐.<br />
最近appstore中国区改版,偶的生活查询获首页推荐,感谢apple,感谢apple fans,打算重写UI,更美观点.去掉一些没有实际用途的功能.<br />
<img src="http://www.ieliwb.com/u/img/itool-apple-iphone-app-new-commend.jpg" alt="" /></p>
<p>再接再励吧,希望英文app卖的好才[......]</p><p class='read-more'><a href='http://www.ieliwb.com/itool-appstore-new-commend/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>好久没更新博客了.最近太忙了,进度很不顺.唯一感到欣慰的是产品获得认可,被苹果邀了宣传画,可惜最后没有上推荐.<br />
最近appstore中国区改版,偶的生活查询获首页推荐,感谢apple,感谢apple fans,打算重写UI,更美观点.去掉一些没有实际用途的功能.<br />
<img src="http://www.ieliwb.com/u/img/itool-apple-iphone-app-new-commend.jpg" alt="" /></p>
<p>再接再励吧,希望英文app卖的好才是王道.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/itool-appstore-new-commend/feed/</wfw:commentRss>
		<slash:comments>1103</slash:comments>
		</item>
		<item>
		<title>可怜的小狗狗</title>
		<link>http://www.ieliwb.com/poor-little-dog/</link>
		<comments>http://www.ieliwb.com/poor-little-dog/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 02:41:19 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[心情随笔/生活感悟]]></category>
		<category><![CDATA[狗狗]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/%e5%8f%af%e6%80%9c%e7%9a%84%e5%b0%8f%e7%8b%97%e7%8b%97/</guid>
		<description><![CDATA[<p>可怜的小狗狗,还没开眼就被人遗弃,被偶一个好心的同事捡到收养了,也算有了归属.上图图:<br />
<img src="http://www.ieliwb.com/u/img/IMG_0299.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0300.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0301.JPG" alt=""  /></p>
<p><img src="http://www.ieliwb.com/u/img/IMG_0298.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0302.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0303.JPG" alt="" /></p>
<p>附带一奶瓶,由此可见主人也不是很残忍,那为什么要遗弃呢?</p>]]></description>
			<content:encoded><![CDATA[<p>可怜的小狗狗,还没开眼就被人遗弃,被偶一个好心的同事捡到收养了,也算有了归属.上图图:<br />
<img src="http://www.ieliwb.com/u/img/IMG_0299.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0300.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0301.JPG" alt=""  /></p>
<p><img src="http://www.ieliwb.com/u/img/IMG_0298.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0302.JPG" alt="" /><br />
<img src="http://www.ieliwb.com/u/img/IMG_0303.JPG" alt="" /></p>
<p>附带一奶瓶,由此可见主人也不是很残忍,那为什么要遗弃呢?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/poor-little-dog/feed/</wfw:commentRss>
		<slash:comments>173</slash:comments>
		</item>
		<item>
		<title>[转]Converting iPhone Apps to Universal Apps</title>
		<link>http://www.ieliwb.com/converting-iphone-apps-to-universal-apps/</link>
		<comments>http://www.ieliwb.com/converting-iphone-apps-to-universal-apps/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 08:53:54 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[Universal]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/?p=255</guid>
		<description><![CDATA[<blockquote><p>很棒的一篇关于Universal程序的心得,原文地址:http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html<br />
(需翻墙)</p></blockquote>
<p>Well, the NDA has finally lift[......]</p><p class='read-more'><a href='http://www.ieliwb.com/converting-iphone-apps-to-universal-apps/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p>很棒的一篇关于Universal程序的心得,原文地址:http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html<br />
(需翻墙)</p></blockquote>
<p>Well, the NDA has finally lifted, so we can start talking about iPhone SDK 3.2 and the iPad. The logical starting place seemed to be how to convert your existing applications into a &#8220;Universal App&#8221; that runs natively both on the iPad and the iPhone/iPod touch. Now, a lot of you have likely already had to figure this stuff out so you could get your updated app on the store today, but for those who didn&#8217;t go the early adopter route, let&#8217;s take a few minutes to look at the process. It&#8217;s pretty straightforward but there are a few gotchas.<br />
<blockquote><i><b>Note</b>: There are some additional things you should know, so read <a href="http://www.ieliwb.com/ipad-iphone-universal-dev/" target="_blank">this post also</a> before tackling your update.</i></p></blockquote>
<p><H3>Targeting All Devices</h3>
<p>The first thing you have to do is identify that you want to build your existing application as a universal application. For this article, I&#8217;m using the Xcode project from <a href="http://code.google.com/p/iphoneparticles/">OpenGL ES Particle Generator Application</a>, but I&#8217;ll try to keep the information general. <i>Note: the following step is not needed if you use Xcode&#8217;s <b>Update Project Target for iPad</b> option talked about <a href="http://www.ieliwb.com/ipad-iphone-universal-dev/" target="_blank">here</a></i>.</p>
<p>Bring up your Project Info window in Xcode by either double-clicking on your project&#8217;s root node in the <em>Groups &#038; Files</em> pane or selecting <strong>Edit Project Settings</strong> from the <strong>Project</strong> menu and then navigate to the <em>Build</em> tab. Now, the change we&#8217;re about to make needs to be made to all configurations, so make sure that the <em>Configuration</em> popup menu is set to <em>All Configurations</em>, otherwise you&#8217;ll only make the change on one configuration.</p>
<p>We need to change a setting called <em>Target Device Family</em>, so type <em>Target</em> into the search bar, or just search for that entry manually (it&#8217;ll be under the <em>Deployment</em> heading). Right now, it should look like this:</p>
<div style="text-align:center;"><img src="http://www.ieliwb.com/u/img/Universal-1.png" border="0" width="809" height="673" /></div>
<p>See how it says <em>iPhone</em>? Yeah, you know what to do. Click on it and change it so it reads <em>iPhone/iPad</em>, like so:</p>
<div style="text-align:center;"><img src="http://www.ieliwb.com/u/img/select_target.png" border="0" width="809" height="673" /></div>
<p>Good! now you&#8217;re done, right? Most likely, no.</p>
<p><H3>Auditing for Hardcoded Sizes</H3><br />The next thing you&#8217;re going to want to do is audit your application to see if you hard-coded the screen size anywhere in your application. You shouldn&#8217;t have hardcoded those values, but let&#8217;s face it, we&#8217;ve all done it. A <em>Project Find</em> (&#8984;&#x21e7;F) for <em>320</em> and <em>480</em> and that should turn up any of those hardcoded values. In the Particle Generator code, I did it in only one place, in code that creates a <font face="monospace">UIImage</font> of the OpenGL view. The line of code where I did it looks like this:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    CGImageRef imageRef = CGImageCreate(<span class="constant constant_numeric constant_numeric_c">320</span>, <span class="constant constant_numeric constant_numeric_c">480</span>, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, <span class="constant constant_language constant_language_c">NULL</span>, <span class="constant constant_language constant_language_objc">NO</span>, renderingIntent);</span></pre>
<p>Usually, the fix for this will be obvious. Instead of hardcoding, you want to pull the width and height from the OpenGL view. The code where I did it actually exists on the <font face="monospace">GLView</font> class, so I can fix it like so:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    CGImageRef imageRef = CGImageCreate(self.frame.size.width, self.frame.size.height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, <span class="constant constant_language constant_language_c">NULL</span>, <span class="constant constant_language constant_language_objc">NO</span>, renderingIntent);</span></pre>
<p>But, what if what you&#8217;ve hardcoded is the actual size of the view? Then you need to pull the size from the main screen instead of the view. That&#8217;s easy enough to do.
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    UIScreen *screen = <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>UIScreen <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">mainScreen</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;    <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>myView <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">setFrame<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>screen <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">applicationFrame</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;</span></pre>
<p><H3>Dealing with Different Window Sizes</H3><br />Most likely your application&#8217;s one instance of <font face="monospace">UIWindow</font> is contained in your <em>MainWindow.xib</em> file that gets loaded automatically. Most likely, that Window is hardcoded to 320&#215;480. Now, you might think that you can just go into Interface Builder and set the autosize attributes for the window and it will get resized for you at launch. You would be wrong. There is no automatic check to make sure your window is the right size.</p>
<p>You have to make sure that the window is the right size for the device you&#8217;re running on. There are, basically, two ways of doing that. If your application is such that you just need to resize the window and your autosize attributes will take care of making everything look nice, then you can just handle this programmatically in <em>applicationDidFinishLaunching:</em> by setting the window&#8217;s size to the size of the screen, less the status bar andy any other objects controlled by the iPhone OS (this is known as the <em>Application Frame</em>). Doing this looks almost exactly like setting the size of the view above:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    <span class="support support_type support_type_quartz">CGRect</span>  rect = <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span><span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>UIScreen <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">mainScreen</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span> <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">bounds</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;    <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>window <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">setFrame<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span>rect</span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;</span></pre>
<p>Now, this is actually a good approach for the <em>Particles</em> application because it has one full-screen view. However, the iPad and the iPhone are really different devices, and there are several UI components available on the iPad that aren&#8217;t available (at least yet) on the iPhone, such as split views and pop up views. For many applications, especially complex applications using a lot of <font face="monospace">UIKit</font> views and controls, you&#8217;re probably going to want to provide completely different NIB file based on which device on which the code is running.</p>
<p><H3>Info.Plist Device-Specific Entries</H3><br />The one really important nib file in every iPhone application is, of course, <em>MainWindow.xib</em>, and there has to be a way to tell your application to use a different <em>MainWindow.xib</em> for different devices. In fact, there is. For each key that <em>Info.plist</em> supports, such <font face="monospace">NSMainNibFile</font>, which is used to specify the name of the application&#8217;s main nib file, you can now specify device-specific entries. If you provide a device-specific entry for the device the application is currently running on, it will use the device-specific value, otherwise it will just use the normal value.</p>
<p>Device-specific keys are exactly the same as the original or default key except the key name is followed by a tilde (~) and then the name of the device in all-lowercase letters. So, to tell our application to load a different nib file for the iPad, we can add a key called <font face="monospace">NSMainNibFile~ipad</font> and then specify the name of the nib file to use when launching on an iPad. For the iPhone and iPod touch, it will continue to use the default value, <em>MainWindow.xib</em>, but for the iPad, it will use the nib file you&#8217;ve specified in the new, device-specific key.</p>
<p>You can add a new version of <em>MainWindow.xib</em> to your project by selecting the <em>Resources</em> group and choosing <strong>Add New File</strong> from the <strong>File</strong> menu. From the New File Assistant, select <em>User Interface</em> from under the iPhone OS, then select <em>Application XIB</em>, and make sure you select the right device in the <em>Product</em> drop-down.</p>
<div style="text-align:center;"><img src="http://www.ieliwb.com/u/img/Universal-2.png" border="0" width="763" height="581" /></div>
<p>Make sure you remember to connect all the outlets and actions in this new nib to the same outlets and actions you used in the other nib. Remember, only one of the application nibs will be loaded, so there&#8217;s no conflict.</p>
<p>For any key in the <em>Info.plist</em> file, you can use this same technique to override the default value with a device specific. You could, for example, have the iPhone version start in Portrait and the iPad version start in landscape, like so:
<pre class="textmate-source mac_classic"><span class="text text_xml">    ...    <span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">key</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>UIInterfaceOrientation<span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">key</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>    <span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">string</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>UIInterfaceOrientationPortrait<span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">string</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>    <span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">key</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>UIInterfaceOrientation~ipad<span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">key</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>    <span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">string</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>UIInterfaceOrientationLandscapeLeft<span class="meta meta_tag meta_tag_xml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_localname entity_name_tag_localname_xml">string</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_xml">&gt;</span></span>    ...</span></pre>
<p><H3>Programmatically Determining Device</H3><br />If you have code that needs to vary depending on whether it&#8217;s running on the iPad or iPhone/iPod touch, Apple has provided a new macro called <font face="monospace">UI_USER_INTERFACE_IDIOM()</font> that will tell you that. There are currently two values defined, <font face="monospace">UIUserInterfaceIdiomPhone</font> and <font face="monospace">UIUserInterfaceIdiomPad</font>, and this macro will return the value that corresponds to the device being run. So, for example, if you needed to push a view controller onto the navigation stack, but wanted a different nib used for the iPad than the iPhone, you might do this:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    MyController *controller = <span class="constant constant_language constant_language_objc">nil</span>;

    <span class="keyword keyword_control keyword_control_c">if</span> (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)        controller = <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span><span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>MyController <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">alloc</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span> <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">initWithNibName<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="string string_quoted string_quoted_double string_quoted_double_objc"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_objc">@"</span>MyiPadNib<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_objc">"</span></span> <span class="support support_function support_function_any-method support_function_any-method_name-of-parameter support_function_any-method_name-of-parameter_objc">bundle<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="constant constant_language constant_language_objc">nil</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;    <span class="keyword keyword_control keyword_control_c">else</span>        controller = <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span><span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>MyController <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">alloc</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span> <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">initWithNibName<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="string string_quoted string_quoted_double string_quoted_double_objc"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_objc">@"</span>MyiPodNib<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_objc">"</span></span> <span class="support support_function support_function_any-method support_function_any-method_name-of-parameter support_function_any-method_name-of-parameter_objc">bundle<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="constant constant_language constant_language_objc">nil</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;

    <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span><span class="variable variable_language variable_language_objc">self</span>.navigationController <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">pushViewController<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span>controller <span class="support support_function support_function_any-method support_function_any-method_name-of-parameter support_function_any-method_name-of-parameter_objc">animated<span class="punctuation punctuation_separator punctuation_separator_arguments punctuation_separator_arguments_objc">:</span></span><span class="constant constant_language constant_language_objc">YES</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;    <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>controller <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">release</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;</span></pre>
<p>If you need finer-grain control, and need to know exactly which device, there&#8217;s no official, supported way to determine the exact device. The vast majority of the time you you think you need to know the device, you don&#8217;t actually need to know the device, you just need to know which features are supported. Even though you can find code around the web that will determine the device based on <font face="monospace">UIDevice</font>, you really shouldn&#8217;t base your logic on that because such code can be fragile since you don&#8217;t know what future devices will exist, or what features they will have.</p>
<p>In cases like the Image Picker, Apple provides a way to determine which features are available on your device, such as whether there&#8217;s a camera, and whether that camera supports video. When Apple hasn&#8217;t provide a specific check or test, what you can do is use <font face="monospace">NSClassFromString()</font>, which (as is probably obvious from the name) creates a <font face="monospace">Class</font> instance based on the name of a class contained in a string. If this returns <font face="monospace">nil</font>, then you know the class you&#8217;re asking about isn&#8217;t available. You can wrap your code that uses classes that aren&#8217;t available everywhere in these checks and make code that works correctly on all devices, and will continue to do so in the future (for the most part &#8211; it&#8217;s never possible to 100% future-proof code). Here&#8217;s an example of checking for the existence of the <font face="monospace">UISplitViewController</font>, which is a new class only available on the iPad:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    <span class="storage storage_type storage_type_objc">Class</span> splitViewController =<span class="punctuation punctuation_whitespace punctuation_whitespace_support punctuation_whitespace_support_function punctuation_whitespace_support_function_leading punctuation_whitespace_support_function_leading_cocoa"> </span><span class="support support_function support_function_cocoa">NSClassFromString</span>(<span class="string string_quoted string_quoted_double string_quoted_double_objc"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_objc">@"</span>UISplitViewController<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_objc">"</span></span>);    <span class="keyword keyword_control keyword_control_c">if</span> (splitViewController)    <span class="meta meta_block meta_block_c">{       UISplitViewController* mySplitViewController = <span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span><span class="meta meta_bracketed meta_bracketed_objc"><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_begin punctuation_section_scope_begin_objc">[</span>splitVCClass <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">alloc</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span> <span class="meta meta_function-call meta_function-call_objc"><span class="support support_function support_function_any-method support_function_any-method_objc">init</span></span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_end punctuation_section_scope_end_objc">]</span></span>;       <span class="comment comment_line comment_line_double-slash comment_line_double-slash_c++"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_c">//</span> ... configure, use, then release</span>    }</span></span></pre>
<p>You can do something similar with C functions by checking if the function is <font face="monospace">NULL</font> For example, one of the frameworks added with iPhone SDK 3.2 is <em>CoreText.framework</em>. If we wanted to use the function <font face="monospace">CTFontCreateWithName()</font> to create a new font using that framework, we could wrap the logic in an interface idiom check, like above, or we could just check to see if the function we want to use exists by seeing if the symbol <font face="monospace">CTFontCreateWithName</font> is <font face="monospace">NULL</font> at runtime, like so:
<pre class="textmate-source mac_classic"><span class="source source_objc source_objc_iphone">    <span class="keyword keyword_control keyword_control_c">if</span> (CTFontCreateWithName != <span class="constant constant_language constant_language_c">NULL</span>)        CTFontFontRef myFont = CTFontCreateWithName(<span class="string string_quoted string_quoted_double string_quoted_double_objc"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_objc">@"</span>Comic Sans<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_objc">"</span></span>, <span class="constant constant_numeric constant_numeric_c">14.0</span>, <span class="constant constant_language constant_language_c">NULL</span>);</span></pre>
<p><H3>Go, Go, Gadget iPad, Go!</H3><br />Well, that pretty much covers the basics you&#8217;ll need to convert your existing iPhone apps to Universal Apps. The more complex your app, the more likely you&#8217;ll want to consider doing separate iPad and iPhone applications. I&#8217;ll show how to add another target to your Xcode project so you can generate two applications from the same project in a future post. For many apps, however, this should be enough to get you porting away, so port away!<BR></BR><BR></BR> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/converting-iphone-apps-to-universal-apps/feed/</wfw:commentRss>
		<slash:comments>1375</slash:comments>
		</item>
		<item>
		<title>Socket communication on the iPhone/iPad</title>
		<link>http://www.ieliwb.com/socket-communication-on-the-iphone-ipad/</link>
		<comments>http://www.ieliwb.com/socket-communication-on-the-iphone-ipad/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 06:06:25 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/socket-communication-on-the-iphoneipad/</guid>
		<description><![CDATA[<p>Some information on socket implementation on the iPhone, because I&#8217;ve found no information on the web and think this could be useful for others [......]</p><p class='read-more'><a href='http://www.ieliwb.com/socket-communication-on-the-iphone-ipad/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>Some information on socket implementation on the iPhone, because I&#8217;ve found no information on the web and think this could be useful for others as well. Caution: More often than not you only want to get the contents of an URL, for this simply use the following:</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Blue;">NSString</span><span style="color: Gray;"> *</span><span style="color: Blue;">someString</span><span style="color: Gray;"> = </span><span style="color: Olive;">[</span><span style="color: Blue;">NSString</span><span style="color: Gray;"> </span><span style="color: Blue;">stringWithContentsOfURL</span><span style="color: Gray;">:</span><span style="color: Olive;">(</span><span style="color: Blue;">NSURL</span><span style="color: Gray;"> *</span><span style="color: Olive;">)</span><span style="color: Blue;">url</span><span style="color: Olive;">]</span><span style="color: Gray;">;</span></div></div>
<p>But if you in fact want to connect low level to a socket and read/write the bytes themselves you can get it running like this:</p>
<div class="hl-surround"><div class="hl-main"><span style="color: #ffa500;">// This will be the read stream.</span><span style="color: Gray;"><br /></span><span style="color: Blue;">CFReadStreamRef</span><span style="color: Gray;"> </span><span style="color: Blue;">myReadStream</span><span style="color: Gray;"> = </span><span class="hl-prepro">NULL</span><span style="color: Gray;">;<br />&nbsp;<br /></span><span style="color: #ffa500;">// This will be the write stream.</span><span style="color: Gray;"><br /></span><span style="color: Blue;">CFReadStreamRef</span><span style="color: Gray;"> </span><span style="color: Blue;">myWriteStream</span><span style="color: Gray;"> = </span><span class="hl-prepro">NULL</span><span style="color: Gray;">;<br />&nbsp;<br /></span><span style="color: #ffa500;">// Create socket.</span><span style="color: Gray;"><br /></span><span style="color: Blue;">CFStreamCreatePairWithSocketToHost</span><span style="color: Olive;">(</span><span style="color: Blue;">kCFAllocatorDefault</span><span style="color: Gray;">,<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">(</span><span style="color: Blue;">CFStringRef</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Blue;">yourHostAsNSString</span><span style="color: Gray;">,<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">yourPortAsInteger</span><span style="color: Gray;">,<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;</span><span style="color: Blue;">myReadStream</span><span style="color: Gray;">,<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;</span><span style="color: Blue;">myWriteStream</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;<br /></span><span style="color: #ffa500;">// Open read stream.</span><span style="color: Gray;"><br /></span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Blue;">myReadStream</span><span style="color: Gray;"> != </span><span class="hl-prepro">NULL</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: Blue;">CFReadStreamOpen</span><span style="color: Olive;">(</span><span style="color: Blue;">myReadStream</span><span style="color: Olive;">))</span><span style="color: Gray;"><br /></span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: #ffa500;">// Read bytes in chunks of ten bytes.</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">UInt8</span><span style="color: Gray;"> </span><span style="color: Blue;">readBuffer</span><span style="color: Olive;">[</span><span style="color: Maroon;">10</span><span style="color: Olive;">]</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">while</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Blue;">CFReadStreamHasBytesAvailable</span><span style="color: Olive;">(</span><span style="color: Blue;">stream</span><span style="color: Olive;">))</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #ffa500;">// Read bytes.</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">CFReadStreamRead</span><span style="color: Olive;">(</span><span style="color: Blue;">stream</span><span style="color: Gray;">, </span><span style="color: Blue;">buffer</span><span style="color: Gray;">, </span><span style="color: Maroon;">10</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #ffa500;">// Do something with your bytes ...</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br /></span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;<br /></span><span style="color: #ffa500;">// Open write stream.</span><span style="color: Gray;"><br /></span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Blue;">myWriteStream</span><span style="color: Gray;"> != </span><span class="hl-prepro">NULL</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: Blue;">CFWriteStreamOpen</span><span style="color: Olive;">(</span><span style="color: Blue;">myWriteStream</span><span style="color: Olive;">))</span><span style="color: Gray;"><br /></span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: #ffa500;">// Write a byte.</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">UInt8</span><span style="color: Gray;"> </span><span style="color: Blue;">writeBuffer</span><span style="color: Olive;">[</span><span style="color: Maroon;">1</span><span style="color: Olive;">]</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">writeBuffer</span><span style="color: Olive;">[</span><span style="color: Maroon;">0</span><span style="color: Olive;">]</span><span style="color: Gray;"> = </span><span style="color: Maroon;">42</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">CFWriteStreamWrite</span><span style="color: Olive;">(</span><span style="color: Blue;">stream</span><span style="color: Gray;">, </span><span style="color: Blue;">writeBuffer</span><span style="color: Gray;">, </span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br /></span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;<br /></span><span style="color: #ffa500;">// Be a good citizen.</span><span style="color: Gray;"><br /></span><span style="color: Blue;">CFReadStreamClose</span><span style="color: Olive;">(</span><span style="color: Blue;">myReadStream</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br /></span><span style="color: Blue;">CFWriteStreamClose</span><span style="color: Olive;">(</span><span style="color: Blue;">myWriteStream</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br /></span><span style="color: Blue;">CFRelease</span><span style="color: Olive;">(</span><span style="color: Blue;">myReadStream</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br /></span><span style="color: Blue;">CFRelease</span><span style="color: Olive;">(</span><span style="color: Blue;">myWriteStream</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/socket-communication-on-the-iphone-ipad/feed/</wfw:commentRss>
		<slash:comments>1254</slash:comments>
		</item>
		<item>
		<title>iPad类似Setting程序，竖屏SplitView小demo</title>
		<link>http://www.ieliwb.com/ipad-custom-split-view-application/</link>
		<comments>http://www.ieliwb.com/ipad-custom-split-view-application/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 01:44:41 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[setting]]></category>
		<category><![CDATA[UISplitViewController]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/?p=253</guid>
		<description><![CDATA[<p>竖屏SplitView，类似系统的setting程序，一个demo。<br />
看到cc很多人在问，发下。</p>
<p>效果：<br />
<a href="http://www.ieliwb.com/app/screenshot.php?s=iWebmasterHD"><img src="http://www.ieliwb.com/app/screenshot/iwebmasterhd/1.png" alt="" /></a></p>
<p>相关讨论：</p>
<p>http://www.cocoachina.com/bbs/read.php?tid-25636-page-1.html</p>
<p>这个讨论内容可能用的上(右边多个控制器相关)：</p>
<p>http:[......]</p><p class='read-more'><a href='http://www.ieliwb.com/ipad-custom-split-view-application/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>竖屏SplitView，类似系统的setting程序，一个demo。<br />
看到cc很多人在问，发下。</p>
<p>效果：<br />
<a href="http://www.ieliwb.com/app/screenshot.php?s=iWebmasterHD"><img src="http://www.ieliwb.com/app/screenshot/iwebmasterhd/1.png" alt="" /></a></p>
<p>相关讨论：</p>
<p>http://www.cocoachina.com/bbs/read.php?tid-25636-page-1.html</p>
<p>这个讨论内容可能用的上(右边多个控制器相关)：</p>
<p>http://www.cocoachina.com/bbs/read.php?tid-24466.html</p>
<p>源码demo：<br />
<a href="http://www.ieliwb.com/u/zip/MasterDetail.zip" target="_blank">下载</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/ipad-custom-split-view-application/feed/</wfw:commentRss>
		<slash:comments>1200</slash:comments>
		</item>
		<item>
		<title>TCP中connect加入的超时控制</title>
		<link>http://www.ieliwb.com/tcp-connect-time-limit-out/</link>
		<comments>http://www.ieliwb.com/tcp-connect-time-limit-out/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 08:12:07 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[超时]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/tcp%e4%b8%adconnect%e5%8a%a0%e5%85%a5%e7%9a%84%e8%b6%85%e6%97%b6%e6%8e%a7%e5%88%b6/</guid>
		<description><![CDATA[<p>最近写iPad下iWebmaster中portscan用到的,备份记录下,大致核心部分如下:</p>
<p>在使用TCP的connect连接服务器时，在默认情况下系统使用的是阻塞式socket，如果服务器当前不可用，则connect会等待知道超时时间到达，而这个超时时间是系统内核规定的，并不能使用setSocke[......]</p><p class='read-more'><a href='http://www.ieliwb.com/tcp-connect-time-limit-out/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>最近写iPad下iWebmaster中portscan用到的,备份记录下,大致核心部分如下:</p>
<p>在使用TCP的connect连接服务器时，在默认情况下系统使用的是阻塞式socket，如果服务器当前不可用，则connect会等待知道超时时间到达，而这个超时时间是系统内核规定的，并不能使用setSocketOpt来设置，这个函数只能设置send和recv的超时，为了能够随意控制connect的超时时间，可以使用select。大致的过程就是先将socket设置成非阻塞，使用select去轮询套接口，再根据套接口去判断连接状态。</p>
<div class="hl-surround"><div class="hl-main"><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">flag</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">flag</span><span style="color: Gray;"> = </span><span style="color: Blue;">fcntl</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,</span><span style="color: Blue;">F_GETFL</span><span style="color: Gray;">,</span><span style="color: Maroon;">0</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">flag</span><span style="color: Gray;"> |= </span><span style="color: Blue;">O_NONBLOCK</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Blue;">fcntl</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,</span><span style="color: Blue;">F_SETFL</span><span style="color: Gray;">,</span><span style="color: Blue;">flag</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span><span style="color: #ffa500;">//设置非阻塞</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Blue;">type</span><span style="color: Gray;"> == </span><span style="color: Blue;">SOCK_STREAM</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">ret</span><span style="color: Gray;"> = -</span><span style="color: Maroon;">1</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">connected</span><span style="color: Gray;"> = </span><span style="color: Blue;">connect</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">, </span><span style="color: Olive;">(</span><span class="hl-types">struct</span><span style="color: Gray;"> </span><span style="color: Blue;">sockaddr</span><span style="color: Gray;"> *</span><span style="color: Olive;">)</span><span style="color: Gray;"> &amp;</span><span style="color: Blue;">address</span><span style="color: Gray;">, <br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">sizeof</span><span style="color: Olive;">(</span><span style="color: Blue;">address</span><span style="color: Olive;">))</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Blue;">connected</span><span style="color: Gray;"> != </span><span style="color: Maroon;">0</span><span style="color: Gray;"> </span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span><span style="color: #ffa500;">//if 1</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: Blue;">errno</span><span style="color: Gray;"> != </span><span style="color: Blue;">EINPROGRESS</span><span style="color: Olive;">)</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">logdown</span><span style="color: Olive;">(</span><span style="color: Blue;">ERROR</span><span style="color: Gray;">,</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">connect error :%s</span><span style="color: Navy;">\</span><span style="color: Red;">n</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">,</span><span style="color: Blue;">strerror</span><span style="color: Olive;">(</span><span style="color: Blue;">errno</span><span style="color: Olive;">))</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">else</span><span style="color: Gray;"> </span><span style="color: #ffa500;">//esle</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="hl-types">struct</span><span style="color: Gray;"> </span><span style="color: Blue;">timeval</span><span style="color: Gray;"> </span><span style="color: Blue;">tm</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">tm</span><span style="color: Gray;">.</span><span style="color: Blue;">tv_sec</span><span style="color: Gray;"> = </span><span style="color: Maroon;">3</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">tm</span><span style="color: Gray;">.</span><span style="color: Blue;">tv_usec</span><span style="color: Gray;"> = </span><span style="color: Maroon;">0</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">fd_set</span><span style="color: Gray;"> </span><span style="color: Blue;">set</span><span style="color: Gray;">,</span><span style="color: Blue;">rset</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">FD_ZERO</span><span style="color: Olive;">(</span><span style="color: Gray;">&amp;</span><span style="color: Blue;">set</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">FD_ZERO</span><span style="color: Olive;">(</span><span style="color: Gray;">&amp;</span><span style="color: Blue;">rset</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">FD_SET</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">set</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">FD_SET</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">rset</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">socklen_t</span><span style="color: Gray;"> </span><span style="color: Blue;">len</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">error</span><span style="color: Gray;"> = -</span><span style="color: Maroon;">1</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">res</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">res</span><span style="color: Gray;"> = </span><span style="color: Blue;">select</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">+</span><span style="color: Maroon;">1</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">rset</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">set</span><span style="color: Gray;">,</span><span class="hl-prepro">NULL</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">tm</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: Blue;">res</span><span style="color: Gray;"> &lt; </span><span style="color: Maroon;">0</span><span style="color: Olive;">)</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">logdown</span><span style="color: Olive;">(</span><span style="color: Blue;">WARNNING</span><span style="color: Gray;">,</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">network error in connect</span><span style="color: Navy;">\</span><span style="color: Red;">n</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">ret</span><span style="color: Gray;"> =&nbsp; -</span><span style="color: Maroon;">1</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">else</span><span style="color: Gray;"> </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: Blue;">res</span><span style="color: Gray;"> == </span><span style="color: Maroon;">0</span><span style="color: Olive;">)</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">logdown</span><span style="color: Olive;">(</span><span style="color: Blue;">WARNNING</span><span style="color: Gray;">,</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">connect time out</span><span style="color: Navy;">\</span><span style="color: Red;">n</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">ret</span><span style="color: Gray;"> = -</span><span style="color: Maroon;">2</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">else</span><span style="color: Gray;"> </span><span style="color: Green;">if</span><span style="color: Gray;"> </span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Gray;"> == </span><span style="color: Blue;">res</span><span style="color: Olive;">)</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: Blue;">FD_ISSET</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,&amp;</span><span style="color: Blue;">set</span><span style="color: Olive;">))</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">flag</span><span style="color: Gray;"> &amp;= ~</span><span style="color: Blue;">O_NONBLOCK</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">fcntl</span><span style="color: Olive;">(</span><span style="color: Blue;">sock</span><span style="color: Gray;">,</span><span style="color: Blue;">F_SETFL</span><span style="color: Gray;">,</span><span style="color: Blue;">flag</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span><span style="color: #ffa500;">//设置阻塞</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;"> </span><span style="color: Blue;">sock</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">else</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">ret</span><span style="color: Gray;"> = -</span><span style="color: Maroon;">3</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Blue;">logdown</span><span style="color: Olive;">(</span><span style="color: Blue;">WARNNING</span><span style="color: Gray;">,</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">other error when select:%s</span><span style="color: Navy;">\</span><span style="color: Red;">n</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">,</span><span style="color: Blue;">strerror</span><span style="color: Olive;">(</span><span style="color: Blue;">errno</span><span style="color: Olive;">))</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;"> </span><span style="color: Blue;">ret</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: #ffa500;">//else </span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: #ffa500;">//if 1</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;"> </span><span style="color: Blue;">sock</span><span style="color: Gray;">;<br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">}</span></div></div>
<p>程序先把socket设置成非阻塞，connect在非阻塞模式下会立刻返回，如果没有其他错误，返回值等于0。当connect不能立刻建立连接时，会返回一个EINPROGRESS，表示连接正在建立的过程中，这时我们可以使用select去轮询套接口，而select的轮询超时时间可以根据自己的需要去设置，最主要的是轮询的集合一定要是读和写的集合，即select的第二和第三个参数要赋值，待select返回就可以去判断返回值来确定connect的进程状态了。如果返回值小于0，说明connect的进程出现了错误，如果是等于0则说明connect超时，如果等于1，并且套接口此时的状态是可写，则说明了connect已经成功建立（关于这点大概是因为服务器接收了连接后，不会立刻想socket写数据，这是客户端就只能轮询到可写的socket，我觉得如果服务器接受连接并立刻写数据，在客户端就可能是返回2，这时学要同时判断socket的可读和可写了）；其他情况的话就算是其他错误吧，至此，我们只需要设置select的超时值就可以随心所欲地实现自己想要的connect连接超时了。</p>
<p>    最后，别忘了把套接口设置会阻塞状态，毕竟阻塞状态加线程方便控制。</p>
<p>效果图:<a href="www.ieliwb.com/app/screenshot.php?s=iWebmasterHD">www.ieliwb.com/app/screenshot.php?s=iWebmasterHD</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/tcp-connect-time-limit-out/feed/</wfw:commentRss>
		<slash:comments>1082</slash:comments>
		</item>
		<item>
		<title>我会一直用心做好产品,做好服务的</title>
		<link>http://www.ieliwb.com/itoolhd-ipad-top-paid/</link>
		<comments>http://www.ieliwb.com/itoolhd-ipad-top-paid/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 13:36:21 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[心情随笔/生活感悟]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iTool]]></category>
		<category><![CDATA[生活查询]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/%e6%88%91%e4%bc%9a%e4%b8%80%e7%9b%b4%e7%94%a8%e5%bf%83%e5%81%9a%e5%a5%bd%e4%ba%a7%e5%93%81%e5%81%9a%e5%a5%bd%e6%9c%8d%e5%8a%a1%e7%9a%84/</guid>
		<description><![CDATA[<p>偶的生活查询for iPad 上线3天登上了中国区付费棒首,小小的祝贺一下.我会一直用心做好产品,做好服务的,感谢Apple,感谢AppStore,感谢所有Apple fans.</p>
<p><img src="http://www.ieliwb.com/u/img/ipad-top-paid.jpg" alt="" /></p>
<p><a href="http://www.ieliwb.com/app/iToolHD.html">生活查询for iPad</a><br />
<a href="http://www.ieliwb.com/app/iTool.html">生活查询for iPhone</a></p>]]></description>
			<content:encoded><![CDATA[<p>偶的生活查询for iPad 上线3天登上了中国区付费棒首,小小的祝贺一下.我会一直用心做好产品,做好服务的,感谢Apple,感谢AppStore,感谢所有Apple fans.</p>
<p><img src="http://www.ieliwb.com/u/img/ipad-top-paid.jpg" alt="" /></p>
<p><a href="http://www.ieliwb.com/app/iToolHD.html">生活查询for iPad</a><br />
<a href="http://www.ieliwb.com/app/iTool.html">生活查询for iPhone</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/itoolhd-ipad-top-paid/feed/</wfw:commentRss>
		<slash:comments>1131</slash:comments>
		</item>
		<item>
		<title>不同控制器之间通信的一个好方法</title>
		<link>http://www.ieliwb.com/nsnotification-observer-communicate/</link>
		<comments>http://www.ieliwb.com/nsnotification-observer-communicate/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 09:48:14 +0000</pubDate>
		<dc:creator>花太香齐</dc:creator>
				<category><![CDATA[iPhone/Mac/ObjectC]]></category>
		<category><![CDATA[NSNotificationCenter]]></category>
		<category><![CDATA[观察者模式]]></category>

		<guid isPermaLink="false">http://www.ieliwb.com/%e4%b8%8d%e5%90%8c%e6%8e%a7%e5%88%b6%e5%99%a8%e4%b9%8b%e9%97%b4%e9%80%9a%e4%bf%a1%e7%9a%84%e4%b8%80%e4%b8%aa%e5%a5%bd%e6%96%b9%e6%b3%95/</guid>
		<description><![CDATA[<p>首页在view1的控制器初始化init方法里加上观察者模式方法:</p>
<blockquote><p>
[[NSNotificationCenter defaultCenter] addObserver:self<br />
												 selector:@selector(reloadChat:)<br />
													 na[......]</p></blockquote><p class='read-more'><a href='http://www.ieliwb.com/nsnotification-observer-communicate/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>首页在view1的控制器初始化init方法里加上观察者模式方法:</p>
<blockquote><p>
[[NSNotificationCenter defaultCenter] addObserver:self<br />
												 selector:@selector(reloadChat:)<br />
													 name:@&#8221;reloadChat&#8221; object:nil];
</p></blockquote>
<blockquote><p>
-(void)reloadChat:(id)sender{}
</p></blockquote>
<hr/>
<p>在view2里的button添加用来触发view1的reloadChat方法:	</p>
<blockquote><p>
[[NSNotificationCenter defaultCenter] postNotificationName:@&#8221;reloadChat&#8221; object:self];
</p></blockquote>
<p>&#8212;END&#8212;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ieliwb.com/nsnotification-observer-communicate/feed/</wfw:commentRss>
		<slash:comments>1129</slash:comments>
		</item>
	</channel>
</rss>

