<?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://blog.kyloo.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kyloo.net</link>
	<description>美东浮生记</description>
	<lastBuildDate>Wed, 27 Apr 2011 14:58:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>微软研究院实习第一天</title>
		<link>http://blog.kyloo.net/2011/04/05/%e5%be%ae%e8%bd%af%e7%a0%94%e7%a9%b6%e9%99%a2%e5%ae%9e%e4%b9%a0%e7%ac%ac%e4%b8%80%e5%a4%a9/</link>
		<comments>http://blog.kyloo.net/2011/04/05/%e5%be%ae%e8%bd%af%e7%a0%94%e7%a9%b6%e9%99%a2%e5%ae%9e%e4%b9%a0%e7%ac%ac%e4%b8%80%e5%a4%a9/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 03:44:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[胡言乱语]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/2011/04/05/%e5%be%ae%e8%bd%af%e7%a0%94%e7%a9%b6%e9%99%a2%e5%ae%9e%e4%b9%a0%e7%ac%ac%e4%b8%80%e5%a4%a9/</guid>
		<description><![CDATA[虽说我老未成年就开始打工，说到正式签约，白纸黑字，报官上税的工作这还是头一回，感觉也不太相同。首先MSR工作环境还是不错的，虽然没有狗狗的免费食物，有免费饮料也还行。可惜都不太健康，不宜多喝。其次呢老板非常热情，不停地问这问那，这也是提早开始intern的好处，等到人多了，就难以得到这么好的照顾了。 西雅图的天气狠糟糕，来了三天，天气分别是晴转中雨，中雨转阴转中雨和中雨。虽说有樱花盛开，在大雨摧残下不知道还能不能等到周末去华大赏花。 总的来说工作比较有热情，虽然没有彻底找到该怎么搞，对这个group的总体vision大略有了一个了解，get things done！ 最后一点就是Windows。叹，为了读一个目录，需要一个权限更新，从一点等到六点，居然没有propagate 到服务器。我都想说你搞个Samba做ActiveDirectory行不行！！！！ 所有工具都要重新拿微软的玩意重新写一遍，这也是最不爽的地方，不过这样也好，不能再Download别人的东西来打马虎眼了。]]></description>
			<content:encoded><![CDATA[<p>虽说我老未成年就开始打工，说到正式签约，白纸黑字，报官上税的工作这还是头一回，感觉也不太相同。首先MSR工作环境还是不错的，虽然没有狗狗的免费食物，有免费饮料也还行。可惜都不太健康，不宜多喝。其次呢老板非常热情，不停地问这问那，这也是提早开始intern的好处，等到人多了，就难以得到这么好的照顾了。
</p>
<p>西雅图的天气狠糟糕，来了三天，天气分别是晴转中雨，中雨转阴转中雨和中雨。虽说有樱花盛开，在大雨摧残下不知道还能不能等到周末去华大赏花。
</p>
<p>总的来说工作比较有热情，虽然没有彻底找到该怎么搞，对这个group的总体vision大略有了一个了解，get things done！
</p>
<p>最后一点就是Windows。叹，为了读一个目录，需要一个权限更新，从一点等到六点，居然没有propagate 到服务器。我都想说你搞个Samba做ActiveDirectory行不行！！！！
</p>
<p>所有工具都要重新拿微软的玩意重新写一遍，这也是最不爽的地方，不过这样也好，不能再Download别人的东西来打马虎眼了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2011/04/05/%e5%be%ae%e8%bd%af%e7%a0%94%e7%a9%b6%e9%99%a2%e5%ae%9e%e4%b9%a0%e7%ac%ac%e4%b8%80%e5%a4%a9/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>最让我感动的动画短片One minute fly</title>
		<link>http://blog.kyloo.net/2011/03/28/%e6%9c%80%e8%ae%a9%e6%88%91%e6%84%9f%e5%8a%a8%e7%9a%84%e5%8a%a8%e7%94%bb%e7%9f%ad%e7%89%87one-minute-fly/</link>
		<comments>http://blog.kyloo.net/2011/03/28/%e6%9c%80%e8%ae%a9%e6%88%91%e6%84%9f%e5%8a%a8%e7%9a%84%e5%8a%a8%e7%94%bb%e7%9f%ad%e7%89%87one-minute-fly/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 14:12:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[胡言乱语]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=302</guid>
		<description><![CDATA[一只只有一分钟生命的苍蝇，如何实现自己的梦想。 也许当人人都做一只one minute fly，生命会更加精彩。]]></description>
			<content:encoded><![CDATA[<p>一只只有一分钟生命的苍蝇，如何实现自己的梦想。</p>
<p><iframe title="YouTube video player" width="500" height="390" src="http://www.youtube.com/embed/6Wf8yEb1cwY" frameborder="0" allowfullscreen></iframe></p>
<p>也许当人人都做一只one minute fly，生命会更加精彩。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2011/03/28/%e6%9c%80%e8%ae%a9%e6%88%91%e6%84%9f%e5%8a%a8%e7%9a%84%e5%8a%a8%e7%94%bb%e7%9f%ad%e7%89%87one-minute-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>图表的艺术……</title>
		<link>http://blog.kyloo.net/2011/01/13/%e5%9b%be%e8%a1%a8%e7%9a%84%e8%89%ba%e6%9c%af%e2%80%a6%e2%80%a6/</link>
		<comments>http://blog.kyloo.net/2011/01/13/%e5%9b%be%e8%a1%a8%e7%9a%84%e8%89%ba%e6%9c%af%e2%80%a6%e2%80%a6/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 03:51:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[胡言乱语]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=297</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div id="attachment_298" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.kyloo.net/wp-content/uploads/2011/01/LCACost.jpg"><img src="http://blog.kyloo.net/wp-content/uploads/2011/01/LCACost-300x203.jpg" alt="" title="LCACost" width="300" height="203" class="size-medium wp-image-298" /></a><p class="wp-caption-text">图表的艺术，不服不行</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2011/01/13/%e5%9b%be%e8%a1%a8%e7%9a%84%e8%89%ba%e6%9c%af%e2%80%a6%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>同音文章</title>
		<link>http://blog.kyloo.net/2010/12/27/%e5%90%8c%e9%9f%b3%e6%96%87%e7%ab%a0/</link>
		<comments>http://blog.kyloo.net/2010/12/27/%e5%90%8c%e9%9f%b3%e6%96%87%e7%ab%a0/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 01:06:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[胡言乱语]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=290</guid>
		<description><![CDATA[施氏食狮史 石室诗士施氏，嗜狮，誓食十狮。适施氏时时适市视狮。十时，适十狮适市。是时，适施氏适市。氏视是十狮，恃矢势，使是十狮逝世。氏拾是十狮尸，适石室。石室湿，氏使侍拭石室。石室拭，氏始 试食是十狮尸。食时，始识是十狮尸，实十石狮尸。示释是事。 侄治痔 芝之稚侄郅，至智，知制纸，知织帜，芝痔炙痔，侄至芝址，知之知芷汁治痔，至芷址，执芷枝，蜘至，踯侄，执直枝掷之，蜘止，侄执芷枝至芝，芝执芷治痔，痔止。芝炙脂雉肢致郅。 季姬击鸡记 季姬寂 集鸡 鸡即棘鸡 棘鸡饥叽 季姬及箕稷济鸡 鸡既济 跻姬笈 季姬忌 急咭鸡 鸡急 继圾几 季姬急 即籍箕击鸡 箕疾击几伎 伎即齑 鸡叽集几基 季姬急极屐击鸡 鸡既殛 季姬激 即记《季姬击鸡记》 羿裔熠 羿裔熠,邑彝,义医，艺诣。 熠姨遗一裔伊,伊仪迤，衣旖，异奕矣。熠意伊矣，易衣以贻伊，伊遗衣，衣异衣以意异熠，熠抑矣。伊驿邑，弋一翳,弈毅，毅仪奕，诣弈，衣异，意逸。毅诣伊，益伊，伊怡，已臆毅矣，毅亦怡伊。翌，伊亦弈毅。毅以蜴贻伊，伊亦贻衣以毅。伊疫，呓毅，癔异矣，倚椅咿咿，毅亦咿咿。毅诣熠，意以熠，议熠医伊，熠懿毅，意役毅逸。毅以熠宜伊，翼逸。熠驿邑以医伊，疑伊胰痍,以蚁医伊，伊遗异，溢，伊咦。熠移伊，刈⑩薏以医，伊益矣。伊忆毅，亦呓毅矣，熠意伊毅已逸，熠意役伊。伊异，噫，缢。 熠癔，亦缢。 遗镒疑医 伊姨殪，遗亿镒。伊诣邑，意医姨疫，一医医伊姨。翌，亿镒遗，疑医，以议医。医以伊疑，缢，以移伊疑。伊倚椅以忆，忆以亿镒遗，以议伊医，亦缢。噫！亦异矣！ 易姨医胰 《易姨医胰》 易姨悒悒，依议诣夷医。医疑胰疫，遗意易姨倚椅，以异仪移姨胰，弋异蚁一亿，胰液溢，蚁殪，胰以医。易胰怡怡，贻医一夷衣。医衣夷衣，怡怡奕奕。噫！以蚁医胰，异矣！以夷衣贻夷医亦宜矣！ 于瑜欲渔 于瑜欲渔，遇余于寓。语余：“余欲渔于渝淤，与余渔渝欤？”余语与瑜：“余欲鬻玉，俞禹欲玉，余欲遇俞于俞寓。”余与于瑜遇俞禹于俞寓，逾俞隅，欲鬻玉于俞，遇雨，雨逾俞宇。余语于瑜：“余欲渔于渝淤，遇雨俞寓，雨逾俞宇，欲渔欤？鬻玉欤？” 于瑜与余御雨于俞寓，俞鬻玉于余禹，雨愈，余与于瑜踽踽逾俞宇，渔于渝淤。 熙戏犀 西溪犀，喜嬉戏。席熙夕夕携犀徙，席熙细细习洗犀。犀吸溪，戏袭熙。席熙嘻嘻希息戏。惜犀嘶嘶喜袭熙。 饥鸡集矶记 唧唧鸡，鸡唧唧。几鸡挤挤集矶脊。机极疾，鸡饥极，鸡冀己技击及鲫。机既济蓟畿，鸡计疾机激几鲫。机疾极，鲫极悸，急急挤集矶级际。继即鲫迹极寂寂，继即几鸡既饥，即唧唧。 狮食豕史 (隋景芳) 狮识豕，豕识狮。始，狮嗜舐豕；豕适。豕时侍狮食柿，狮适。时逝，狮始试豕势。狮舐豕时，适时试噬豕。狮嗜豕时，豕试噬狮。狮嗜豕时，豕适示狮。豕噬狮 时，狮奭。豕始识狮势实势。豕蓍筮，筮示：狮实誓噬弑豕。豕饰失势，事事适狮。时时侍狮。师事狮。试使狮释豕。 是时，豕视虱噬狮，狮拭虱，狮实失适。豕舐狮时，噬虱示狮。豕时时噬虱示狮，使狮适。狮视豕噬虱，狮释。狮始识豕势实是噬虱，豕失势。狮始矢誓弑豕。适 时，豕适噬虱示狮，狮示豕：豕噬虱失实，豕实是试弑狮。狮始施狮式示豕。豕视狮式，豕失屎。狮始噬弑豕。 狮噬食豕势，豕失势，豕逝世。 适时，十豕驶适。十豕视豕尸，奭。十豕誓师，誓使狮释豕尸事实。狮释：狮食实是柿，食豕是失实。狮视豕是‘士’，豕视狮是‘师’。狮事事适豕，豕失识世事。豕时拭狮豕屎；时施矢石弑狮。适时狮驶，豕施矢石弑狮失事，豕弑豕，豕逝世。狮饰弑豕事实，十豕释，驶逝。 豕逝世，狮失豕侍。狮食失柿。狮始试食豕尸。狮食豕尸实适。狮始识豕尸实适狮食。是始，狮时时弑豕，嗜食豕尸。 始，狮视十豕势似狮。时逝，狮始识，十豕势实似豕。视十豕是十尸。适时，狮视十豕适，狮施狮式示十豕。狮恃势噬弑豕。十豕失是豕，十豕驶逝。 狮拾豕尸适市。使絁饰豕尸。狮视市，示市：狮是豕师，豕师事狮。豕视师失食，豕矢誓使师食豕。豕逝世，侍师食豕尸，豕实是‘士’。狮食豕，狮失‘士’，实 狮蚀。是使狮谥豕：‘豕氏’。谥豕‘仕’。狮示市：十豕师事‘豕士’。 狮时适市，施狮式示市。诗《狮食豕史诗〉示市： [...]]]></description>
			<content:encoded><![CDATA[<h2>施氏食狮史</h2>
<blockquote><p>石室诗士施氏，嗜狮，誓食十狮。适施氏时时适市视狮。十时，适十狮适市。是时，适施氏适市。氏视是十狮，恃矢势，使是十狮逝世。氏拾是十狮尸，适石室。石室湿，氏使侍拭石室。石室拭，氏始 试食是十狮尸。食时，始识是十狮尸，实十石狮尸。示释是事。</p>
</blockquote>
<h2>侄治痔</h2>
<blockquote><p>芝之稚侄郅，至智，知制纸，知织帜，芝痔炙痔，侄至芝址，知之知芷汁治痔，至芷址，执芷枝，蜘至，踯侄，执直枝掷之，蜘止，侄执芷枝至芝，芝执芷治痔，痔止。芝炙脂雉肢致郅。</p>
</blockquote>
<h2>季姬击鸡记</h2>
<blockquote><p>季姬寂 集鸡 鸡即棘鸡 棘鸡饥叽 季姬及箕稷济鸡 鸡既济 跻姬笈 季姬忌 急咭鸡 鸡急 继圾几 季姬急 即籍箕击鸡 箕疾击几伎 伎即齑 鸡叽集几基 季姬急极屐击鸡 鸡既殛 季姬激 即记《季姬击鸡记》</p>
</blockquote>
<h2>羿裔熠</h2>
<blockquote><p>羿裔熠,邑彝,义医，艺诣。 熠姨遗一裔伊,伊仪迤，衣旖，异奕矣。熠意伊矣，易衣以贻伊，伊遗衣，衣异衣以意异熠，熠抑矣。伊驿邑，弋一翳,弈毅，毅仪奕，诣弈，衣异，意逸。毅诣伊，益伊，伊怡，已臆毅矣，毅亦怡伊。翌，伊亦弈毅。毅以蜴贻伊，伊亦贻衣以毅。伊疫，呓毅，癔异矣，倚椅咿咿，毅亦咿咿。毅诣熠，意以熠，议熠医伊，熠懿毅，意役毅逸。毅以熠宜伊，翼逸。熠驿邑以医伊，疑伊胰痍,以蚁医伊，伊遗异，溢，伊咦。熠移伊，刈⑩薏以医，伊益矣。伊忆毅，亦呓毅矣，熠意伊毅已逸，熠意役伊。伊异，噫，缢。 熠癔，亦缢。</p>
</blockquote>
<h2>遗镒疑医</h2>
<blockquote><p>伊姨殪，遗亿镒。伊诣邑，意医姨疫，一医医伊姨。翌，亿镒遗，疑医，以议医。医以伊疑，缢，以移伊疑。伊倚椅以忆，忆以亿镒遗，以议伊医，亦缢。噫！亦异矣！</p>
</blockquote>
<h2>易姨医胰</h2>
<blockquote><p>《易姨医胰》 易姨悒悒，依议诣夷医。医疑胰疫，遗意易姨倚椅，以异仪移姨胰，弋异蚁一亿，胰液溢，蚁殪，胰以医。易胰怡怡，贻医一夷衣。医衣夷衣，怡怡奕奕。噫！以蚁医胰，异矣！以夷衣贻夷医亦宜矣！</p>
</blockquote>
<h2>于瑜欲渔</h2>
<blockquote><p>于瑜欲渔，遇余于寓。语余：“余欲渔于渝淤，与余渔渝欤？”余语与瑜：“余欲鬻玉，俞禹欲玉，余欲遇俞于俞寓。”余与于瑜遇俞禹于俞寓，逾俞隅，欲鬻玉于俞，遇雨，雨逾俞宇。余语于瑜：“余欲渔于渝淤，遇雨俞寓，雨逾俞宇，欲渔欤？鬻玉欤？” 于瑜与余御雨于俞寓，俞鬻玉于余禹，雨愈，余与于瑜踽踽逾俞宇，渔于渝淤。</p>
</blockquote>
<h2>熙戏犀</h2>
<blockquote><p>西溪犀，喜嬉戏。席熙夕夕携犀徙，席熙细细习洗犀。犀吸溪，戏袭熙。席熙嘻嘻希息戏。惜犀嘶嘶喜袭熙。</p>
</blockquote>
<h2>饥鸡集矶记</h2>
<blockquote><p>唧唧鸡，鸡唧唧。几鸡挤挤集矶脊。机极疾，鸡饥极，鸡冀己技击及鲫。机既济蓟畿，鸡计疾机激几鲫。机疾极，鲫极悸，急急挤集矶级际。继即鲫迹极寂寂，继即几鸡既饥，即唧唧。</p>
</blockquote>
<h2>狮食豕史 (隋景芳)</h2>
<blockquote>
<p>狮识豕，豕识狮。始，狮嗜舐豕；豕适。豕时侍狮食柿，狮适。时逝，狮始试豕势。狮舐豕时，适时试噬豕。狮嗜豕时，豕试噬狮。狮嗜豕时，豕适示狮。豕噬狮 时，狮奭。豕始识狮势实势。豕蓍筮，筮示：狮实誓噬弑豕。豕饰失势，事事适狮。时时侍狮。师事狮。试使狮释豕。 是时，豕视虱噬狮，狮拭虱，狮实失适。豕舐狮时，噬虱示狮。豕时时噬虱示狮，使狮适。狮视豕噬虱，狮释。狮始识豕势实是噬虱，豕失势。狮始矢誓弑豕。适 时，豕适噬虱示狮，狮示豕：豕噬虱失实，豕实是试弑狮。狮始施狮式示豕。豕视狮式，豕失屎。狮始噬弑豕。 狮噬食豕势，豕失势，豕逝世。 </p>
<p> 适时，十豕驶适。十豕视豕尸，奭。十豕誓师，誓使狮释豕尸事实。狮释：狮食实是柿，食豕是失实。狮视豕是‘士’，豕视狮是‘师’。狮事事适豕，豕失识世事。豕时拭狮豕屎；时施矢石弑狮。适时狮驶，豕施矢石弑狮失事，豕弑豕，豕逝世。狮饰弑豕事实，十豕释，驶逝。 </p>
<p> 豕逝世，狮失豕侍。狮食失柿。狮始试食豕尸。狮食豕尸实适。狮始识豕尸实适狮食。是始，狮时时弑豕，嗜食豕尸。</p>
<p>  始，狮视十豕势似狮。时逝，狮始识，十豕势实似豕。视十豕是十尸。适时，狮视十豕适，狮施狮式示十豕。狮恃势噬弑豕。十豕失是豕，十豕驶逝。 狮拾豕尸适市。使絁饰豕尸。狮视市，示市：狮是豕师，豕师事狮。豕视师失食，豕矢誓使师食豕。豕逝世，侍师食豕尸，豕实是‘士’。狮食豕，狮失‘士’，实 狮蚀。是使狮谥豕：‘豕氏’。谥豕‘仕’。狮示市：十豕师事‘豕士’。</p>
<p>    狮时适市，施狮式示市。诗《狮食豕史诗〉示市： </p>
<p>    狮食实是豕，豕食实是柿。时时狮食豕，世世豕食柿。 </p>
<p>    事实是事实，实事是实事。世视狮食豕，实是事实事。 </p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/12/27/%e5%90%8c%e9%9f%b3%e6%96%87%e7%ab%a0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPhone开发笔记(3) 使用PickerView</title>
		<link>http://blog.kyloo.net/2010/08/09/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b03-%e4%bd%bf%e7%94%a8pickerview/</link>
		<comments>http://blog.kyloo.net/2010/08/09/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b03-%e4%bd%bf%e7%94%a8pickerview/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 19:56:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[胡言乱语]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=275</guid>
		<description><![CDATA[Picker View需要两个接口：DataSource和Delegate。 在定义接口的地方要有如下定义: 一个类必须至少实现下列方法： @interface SingleComponentPickerViewController : UIViewController &#60;UIPickerViewDelegate, UIPickerViewDataSource&#62; #pragma mark - #pragma mark Picker Data Source Methods - &#40;NSInteger&#41; numberOfComponentsInPickerView: &#40;UIPickerView *&#41; pickerView &#123; &#160; &#160; return 1; &#125; - &#40;NSInteger&#41; pickerView: &#40;UIPickerView *&#41;pickerView numberOfRowsInComponent: &#40;NSInteger&#41; component &#123; &#160; &#160; return &#91;pickerData count&#93;; &#125; #pragma mark Picker Delegate Methods - &#40;NSString *&#41; pickerView:&#40;UIPickerView [...]]]></description>
			<content:encoded><![CDATA[<p>Picker View需要两个接口：DataSource和Delegate。<br />
在定义接口的地方要有如下定义: </p>
<p>一个类必须至少实现下列方法：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a61390;">@interface</span> SingleComponentPickerViewController <span style="color: #002200;">:</span> UIViewController<br />
&lt;UIPickerViewDelegate, UIPickerViewDataSource&gt;</div></div>
</pre>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#pragma mark -</span><br />
<span style="color: #6e371a;">#pragma mark Picker Data Source Methods</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> numberOfComponentsInPickerView<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> pickerView<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #2400d9;">1</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> pickerView<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>pickerView<br />
numberOfRowsInComponent<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> component<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>pickerData count<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #6e371a;">#pragma mark Picker Delegate Methods</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> pickerView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>pickerView titleForRow<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> row<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forComponent<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> component<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>pickerData objectAtIndex<span style="color: #002200;">:</span>row<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p>其中Data Source提供了数据，而Delegate则实际获取数据。</p>
<p> 如果要接收某个Component被选择的消息，则要实现一个delegate方法: </p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> pickerView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> pickerView<br />
didSelectRow<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> row<br />
&nbsp; &nbsp; &nbsp; &nbsp; inComponent<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> component<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>component <span style="color: #002200;">==</span> kStateComponent<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>selectedState <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.states objectAtIndex<span style="color: #002200;">:</span>row<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>array <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>stateZips objectForKey<span style="color: #002200;">:</span>selectedState<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.zips <span style="color: #002200;">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>picker selectRow<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span> inComponent<span style="color: #002200;">:</span> kZipComponent animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>picker reloadComponent<span style="color: #002200;">:</span>kZipComponent<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p> 另外，下面的例子简要说明如何使用NSDictionary </p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> <span style="color: #002200;">*</span>bundle <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> mainBundle<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>plistPath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>bundle pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;statedictionary&quot;</span> ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;plist&quot;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">*</span>dictionary <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithContentsOfFile<span style="color: #002200;">:</span>plistPath<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.stateZips <span style="color: #002200;">=</span> dictionary;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>dictionary release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>components <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.stateZips allKeys<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>sorted <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>components sortedArrayUsingSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>compare<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.states <span style="color: #002200;">=</span> sorted;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>selectedState <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.states objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>array <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>stateZips objectForKey<span style="color: #002200;">:</span>selectedState<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.zips <span style="color: #002200;">=</span> array;</div></div>
</pre>
<p>更改每个组件的宽度也可以用代理实现：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>CGFloat<span style="color: #002200;">&#41;</span> pickerView<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> pickerView<br />
widthForComponent<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> component<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>component <span style="color: #002200;">==</span> kZipComponent<span style="color: #002200;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #2400d9;">90</span>;<br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #2400d9;">200</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p>注意到前面我们在- (NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger) row forComponent:（ NSInteger) component 代理方法中，实现的是返回一个NSString。如果要显示图片，则需要实现另一个代理方法</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UIView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> pickerView <span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>UIPickerView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>pickerView viewForRow<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> row forComponent <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span> component</div></div>
</pre>
<p>该方法返回一个View对象。可以用下面方法创建Image View</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">UIImage <span style="color: #002200;">*</span>bar <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;filename&quot;</span><span style="color: #002200;">&#93;</span>;<br />
UIImageView <span style="color: #002200;">*</span>x <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span>bar<span style="color: #002200;">&#93;</span>;</div></div>
</pre>
<p>最后，注意一个方法，可以用以下方法动态为不同名字的field设置值：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span>self setValue<span style="color: #002200;">:</span>value forKey<span style="color: #002200;">:</span>fieldName<span style="color: #002200;">&#93;</span></div></div>
</pre>
<p>Field name 可以是字符串，同时也是变量名称。很动态哦。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/08/09/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b03-%e4%bd%bf%e7%94%a8pickerview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPhone 开发笔记 （2）构造和添加View的一般过程</title>
		<link>http://blog.kyloo.net/2010/08/09/iphone-%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0-%ef%bc%882%ef%bc%89%e6%9e%84%e9%80%a0%e5%92%8c%e6%b7%bb%e5%8a%a0view%e7%9a%84%e4%b8%80%e8%88%ac%e8%bf%87%e7%a8%8b/</link>
		<comments>http://blog.kyloo.net/2010/08/09/iphone-%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0-%ef%bc%882%ef%bc%89%e6%9e%84%e9%80%a0%e5%92%8c%e6%b7%bb%e5%8a%a0view%e7%9a%84%e4%b8%80%e8%88%ac%e8%bf%87%e7%a8%8b/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 05:12:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[数码生活]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=268</guid>
		<description><![CDATA[构造、添加View并在View之间切换是IPhone开发最常见的问题。一般来说，要构造一个View需要以下几个步骤： 添加新的Controller类型。具体方法是File&#8211;>New File&#8211;>Cocoa Touch Class&#8211;>UIViewController subclass。 添加xib文件。具体方法是File&#8211;>New File&#8211;>User Interface&#8211;>View Xib 。 在新的xib文件中制定需要使用的Controller。具体方法是用IBuilder打开对应的xib文件，选择File&#8217;s Owner，将其Class Identity &#8211;> Class 属性改成对应Controller。而后，将File&#8217;s Owner的&#8221;view&#8221; Outlet连接到View对象（按住Command，将File&#8217;s Owner）拖到View上，放开，选&#8221;view&#8221;。 如果需要重载UIView class，将View的Class对应地修改。 切换View分两种，第一是在启动地时候选择一个View。这需要修改AppDelegate头文件和m文件。首先，要修改MainWindow.xib。首先要把要显示地View的一个实例添加到xib中。将Library 中一个View Controller 添加到MainWindow.xib中（放到File&#8217;s Owner边上)。而后把其控制器改为你要选用的View Controller subclass。这样，在启动时，程序自动加载MainWindow.xib的同时，也就加载了你定义的这个View。如果我们需要在delegate里头操作这个Controller的话，就需要在Delegate类中添加一个Outlet，并把View Instance连接到这个Outlet。而真正显示这个View，必须在delegate中做以下连接： - &#40;BOOL&#41;application:&#40;UIApplication *&#41;application didFinishLaunchingWithOptions:&#40;NSDictionary *&#41;launchOptions &#123; &#160; &#160; // Override point for customization after application launch. &#160; &#160; &#91;window addSubview:switchViewController.view&#93;; // Key Point! &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>构造、添加View并在View之间切换是IPhone开发最常见的问题。一般来说，要构造一个View需要以下几个步骤：</p>
<ol>
<li>添加新的Controller类型。具体方法是File&#8211;>New File&#8211;>Cocoa Touch Class&#8211;>UIViewController subclass。</li>
<li>添加xib文件。具体方法是File&#8211;>New File&#8211;>User Interface&#8211;>View Xib 。</li>
<li>在新的xib文件中制定需要使用的Controller。具体方法是用IBuilder打开对应的xib文件，选择File&#8217;s Owner，将其Class Identity &#8211;> Class 属性改成对应Controller。而后，将File&#8217;s Owner的&#8221;view&#8221; Outlet连接到View对象（按住Command，将File&#8217;s Owner）拖到View上，放开，选&#8221;view&#8221;。</li>
<li>如果需要重载UIView class，将View的Class对应地修改。</li>
</ol>
<p>切换View分两种，第一是在启动地时候选择一个View。这需要修改AppDelegate头文件和m文件。首先，要修改MainWindow.xib。首先要把要显示地View的一个实例添加到xib中。将Library 中一个View Controller 添加到MainWindow.xib中（放到File&#8217;s Owner边上)。而后把其控制器改为你要选用的View Controller subclass。这样，在启动时，程序自动加载MainWindow.xib的同时，也就加载了你定义的这个View。如果我们需要在delegate里头操作这个Controller的话，就需要在Delegate类中添加一个Outlet，并把View Instance连接到这个Outlet。而真正显示这个View，必须在delegate中做以下连接：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>application<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application didFinishLaunchingWithOptions<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>launchOptions <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Override point for customization after application launch.</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span>switchViewController.view<span style="color: #002200;">&#93;</span>; <span style="color: #11740a; font-style: italic;">// Key Point!</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p> 而如果要动态加载和切换View，则注意以下几个函数：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>self.yellowViewController <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; YellowViewController <span style="color: #002200;">*</span>yellowController <span style="color: #002200;">=</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>YellowViewController alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;initWithNibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;YellowView&quot;</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.yellowViewController <span style="color: #002200;">=</span> yellowController;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowController release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self.blueViewController.view.superview <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController.view removeFromSuperview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.view insertSubview<span style="color: #002200;">:</span>blueViewController.view atIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController.view removeFromSuperview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.view insertSubview<span style="color: #002200;">:</span>yellowViewController.view atIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span></div></div>
</pre>
<p>一个最复杂的动画切换，目前就给个例子： </p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;View Flip&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span><span style="color: #2400d9;">1.25</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationCurve<span style="color: #002200;">:</span>UIViewAnimationCurveEaseInOut<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self.blueViewController.view.superview <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationTransition<span style="color: #002200;">:</span>UIViewAnimationTransitionFlipFromRight<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forView<span style="color: #002200;">:</span>self.view cache<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController viewWillDisappear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController viewWillAppear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController.view removeFromSuperview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.view insertSubview<span style="color: #002200;">:</span>blueViewController.view atIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController viewDidDisappear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController viewDidAppear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationTransition<span style="color: #002200;">:</span>UIViewAnimationTransitionFlipFromRight<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forView<span style="color: #002200;">:</span>self.view cache<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController viewWillAppear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController viewWillDisappear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController.view removeFromSuperview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.view insertSubview<span style="color: #002200;">:</span>yellowViewController.view atIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>yellowViewController viewDidAppear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>blueViewController viewDidDisappear<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;</div></div>
</pre>
<p>
<font color="#FF0000"><br />
特别需要注意，今天尝试实现Tab Controller，一旦需要加载Outlet的时候就收到SIGABRT。问题何在？下面详细写写如何使用Tab Controller。<br />
</font>
</p>
<p> 第一步，建立一个新的Tab Bar Application。如果不准备使用Tab Bar Application而是用Window Based的话，需要用上面方法添加一个UITabBarController作为Root View。二者效果相同，推荐直接用Tab Bar Application。</p>
<p> 第二步，添加新的View到Tab Bar。这里有一些trick。基本上，建立xib，controller，连接等都相同，要加入Tab Bar，首先选取Tab Bar对象，在Attribute Inspector里头，添加足够数量的View Controllers，一个Controller对应一个tab。而后在界面点选每一个Tab，选择其Nib Name，并在<font color="#FF000"> Identity Inspector里头选正确的Controller!!! 这步及其重要，否则添加任何Outlet都会产生SIGABRT。<font> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/08/09/iphone-%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0-%ef%bc%882%ef%bc%89%e6%9e%84%e9%80%a0%e5%92%8c%e6%b7%bb%e5%8a%a0view%e7%9a%84%e4%b8%80%e8%88%ac%e8%bf%87%e7%a8%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IPhone开发笔记（1）</title>
		<link>http://blog.kyloo.net/2010/08/08/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89/</link>
		<comments>http://blog.kyloo.net/2010/08/08/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 17:13:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[数码生活]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=238</guid>
		<description><![CDATA[Property 属性： @property (retain, nonatomic) UILabel *statusText; retain: 必须，不使用垃圾收集机制（不支持） nonatomic: 如果不用多线程，可以节约开销 在.m文件中，还要添加@synthesis statustext; 一句，来自动添加对应得方法实现。如果我们retain了这个对象，那么我们应该正确的释放它，否则会泄露。应该在dealloc方法中加入 [statusText release]; Outlet &#38; Action 每当要在Controller中修改、引用对象，采用Outlet，Action就是event. 我们在修改一个View之后，可以直接将Outlet / Action拖动到File&#8217;s Owner Object上，这个Object就代表对应的那个Class。按住 Control把File&#8217;s Owner 拖动到每个需要定义Outlet的对象上，并选择合适的Outlet，吧对应的Action拖动到File&#8217;s Owner上，并选择合适的Action. 按钮 按钮标题有四种状态，包括normal, highlighted, disabled and selected。获取titile需要用以下方法： NSString* title = [sender titleForState:UIControlStateNormal]; 字符串操作 创建新的字符串可以用initWithFormat方法，完整得参考可以看这里。 简单的例子： NSString* newText = [[NSString alloc] initWithFormat: @&#8221;%@button pressed.&#8221;, title]; 而多个变量的例子： NSString* buf=[[NSString [...]]]></description>
			<content:encoded><![CDATA[<h3>Property 属性：</h3>
<p>@property (retain, nonatomic) UILabel *statusText;</p>
<p>retain: 必须，不使用垃圾收集机制（不支持）</p>
<p>nonatomic: 如果不用多线程，可以节约开销</p>
<p>在.m文件中，还要添加@synthesis statustext; 一句，来自动添加对应得方法实现。如果我们retain了这个对象，那么我们应该正确的释放它，否则会泄露。应该在dealloc方法中加入</p>
<p>[statusText release];</p>
<h3>Outlet &amp; Action</h3>
<p>每当要在Controller中修改、引用对象，采用Outlet，Action就是event. 我们在修改一个View之后，可以直接将Outlet / Action拖动到File&#8217;s Owner Object上，这个Object就代表对应的那个Class。按住 Control把File&#8217;s Owner 拖动到每个需要定义Outlet的对象上，并选择合适的Outlet，吧对应的Action拖动到File&#8217;s Owner上，并选择合适的Action.</p>
<h3>按钮</h3>
<p><br class="spacer_" /></p>
<p>按钮标题有四种状态，包括normal, highlighted, disabled and selected。获取titile需要用以下方法：</p>
<p>NSString* title = [sender titleForState:UIControlStateNormal];</p>
<h3>字符串操作</h3>
<p>创建新的字符串可以用initWithFormat方法，完整得参考可以看<a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithFormat:">这里</a>。</p>
<p>简单的例子：</p>
<p>NSString* newText = [[NSString alloc] initWithFormat: @&#8221;%@button pressed.&#8221;, title];</p>
<p>而多个变量的例子：</p>
<pre>NSString* buf=[[NSString alloc] initWithFormat:@"The variable %s has
the value %d\n", varName, varVal];</pre>
<p>主意的是这里Allocate完一定要release掉。</p>
<pre> [buf release]; </pre>
<h3>文本字段</h3>
<p>常用属性：</p>
<ul>
<li> Placeholder 当没有值的时候，提示用户输入用的文本。</li>
<li>更改Keyboard/ Capitalize等属性来设置弹出键盘。 </li>
</ul>
<p>关闭键盘的两种方法，一是相应Did End on Exit Action，然后调用Sender的resignFirstResponder方法。二是用一个巨大的Button放在背景，当按它的时候把所有Text Field都resign. </p>
<h3> 显示确认对话框 </h3>
<p>分为两步，首先是如何显示对话框。下面代码是例子：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span> doSomething<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span> sender<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIActionSheet <span style="color: #002200;">*</span>actionSheet <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActionSheet alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Are you sure&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delegate<span style="color: #002200;">:</span>self<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;No Way!&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destructiveButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Yes, I am sure&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; otherButtonTitles<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>actionSheet showInView<span style="color: #002200;">:</span>self.view<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>actionSheet release<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p>同时，要响应用户所点击的结果，则需要首先让我们的Controller实现相应的类。比如</p>
<p><div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br <span style="color: #002200;">/</span>&gt;<br />
<span style="color: #a61390;">@interface</span> ControlFunViewController <span style="color: #002200;">:</span> UIViewController &lt;UIActionSheetDelegate&gt; <span style="color: #002200;">&#123;</span>&lt;br <span style="color: #002200;">/</span>&gt;<br />
...&lt;br <span style="color: #002200;">/</span>&gt;<br />
<span style="color: #002200;">&#125;</span>&lt;br <span style="color: #002200;">/</span>&gt;</div></div>
</p>
<p>而后实现对应的方法 </p>
<p><div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br <span style="color: #002200;">/</span>&gt;<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>actionSheet<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIActionSheet <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>actionSheet&lt;br <span style="color: #002200;">/</span>&gt;<br />
didDismissWithButtonIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>buttonIndex;&lt;br <span style="color: #002200;">/</span>&gt;</div></div>
</p>
<p>在这些方法中，我们要取得用户点击了哪个按钮，通过buttonIndex参数来实现。例如： </p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>actionSheet<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIActionSheet <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>actionSheet<br />
didDismissWithButtonIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>buttonIndex<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>buttonIndex <span style="color: #002200;">==</span> <span style="color: #002200;">&#91;</span>actionSheet cancelButtonIndex<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>msg <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>nameField.text.length&gt;<span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> alloc<span style="color: #002200;">&#93;</span> initWithFormat<span style="color: #002200;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;You can breathe easy, %@, everything went OK.&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nameField.text<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#125;</span><span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;You can breathe easy, everything went OK.&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; UIAlertView <span style="color: #002200;">*</span>alert <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIAlertView alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Something was done&quot;</span> message<span style="color: #002200;">:</span>msg delegate<span style="color: #002200;">:</span>self cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Phew&quot;</span> otherButtonTitles<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>alert show<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>alert release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>msg release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<h3>View的OnLoad事件</h3>
<p>重载View的viewDIdLoad方法(无参数)。下面是例子：</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIImage <span style="color: #002200;">*</span>buttonImageNormal <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;whiteButton.png&quot;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; UIImage <span style="color: #002200;">*</span>stretchableButtonImageNormal <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>buttonImageNormal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stretchableImageWithLeftCapWidth<span style="color: #002200;">:</span><span style="color: #2400d9;">12</span> topCapHeight<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>doSomethingButton setBackgroundImage<span style="color: #002200;">:</span>stretchableButtonImageNormal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; UIImage <span style="color: #002200;">*</span>blueImagePressed <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;blueButton.png&quot;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; UIImage <span style="color: #002200;">*</span>stretchableButtonImagePressed <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>blueImagePressed stretchableImageWithLeftCapWidth<span style="color: #002200;">:</span><span style="color: #2400d9;">12</span> topCapHeight<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>doSomethingButton setBackgroundImage<span style="color: #002200;">:</span>stretchableButtonImagePressed forState<span style="color: #002200;">:</span>UIControlStateHighlighted<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
&lt;<span style="color: #002200;">/</span>pre&gt;<br />
&lt;h3&gt; 旋转和移动控件&lt;<span style="color: #002200;">/</span>h3&gt;<br />
&lt;p&gt; 旋转支持需要设置对应View的方法： &lt;<span style="color: #002200;">/</span>p&gt;<br />
&lt;pre&gt;<span style="color: #002200;">&#91;</span>cc lang<span style="color: #002200;">=</span><span style="color: #bf1d1a;">&quot;objc&quot;</span><span style="color: #002200;">&#93;</span><br />
<span style="color: #11740a; font-style: italic;">// Override to allow orientations other than the default portrait orientation.</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>shouldAutorotateToInterfaceOrientation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIInterfaceOrientation<span style="color: #002200;">&#41;</span>interfaceOrientation <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Return YES for supported orientations</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span>interfaceOrientation <span style="color: #002200;">!=</span> UIInterfaceOrientationPortraitUpsideDown<span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
</pre>
<p>同时，发生旋转的时候会调用对应View的</p>
<pre>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">button1.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">20</span>, <span style="color: #2400d9;">20</span>, <span style="color: #2400d9;">125</span>, <span style="color: #2400d9;">125</span><span style="color: #002200;">&#41;</span>;</div></div>
</pre>
<p> 对应的，四个参数分别为左上x,y和长宽。 通过嵌套[UIView beginAnimations:@"move buttons" context:nil];&#8230;[UIView commitAnimations]; 语句，能够实现动画。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/08/08/iphone%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0%ef%bc%881%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T410安装MacOSX（非常暴力的）</title>
		<link>http://blog.kyloo.net/2010/07/21/t410%e5%ae%89%e8%a3%85macosx%ef%bc%88%e9%9d%9e%e5%b8%b8%e6%9a%b4%e5%8a%9b%e7%9a%84%ef%bc%89/</link>
		<comments>http://blog.kyloo.net/2010/07/21/t410%e5%ae%89%e8%a3%85macosx%ef%bc%88%e9%9d%9e%e5%b8%b8%e6%9a%b4%e5%8a%9b%e7%9a%84%ef%bc%89/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 05:28:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[数码生活]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=226</guid>
		<description><![CDATA[这件事血黄血暴力了，手头只有10.6.3的安装光盘，用bootthink启动死活不行，都是直接重启。设置busratio＝17，成功但是五国。不想花费太多时间于是直接用TrueImage 把整个在Vostro上安装好的分区镜像过来，启动是用busratio＝17，并配上以下的kext，同时删除ATA相关Kext，启动成功。 AppleACPIBatteryManager.kext 显示电池容量 AppleIntelE1000e.kext 内置网卡 声卡用VoodooHDA驱动没有问题，切记必须删除AppleHDA, LegacyHDA等，否则VoodooHDA不能工作。 最后是显卡，我的是独立显卡NV Quadro 3100M。采用前述Vostro 200方法安装可以进入，有QE/CI，但是无DH，查找外接显示器直接黑屏。最后解决方法是DSDT。首先用Everest生成DSDT，再用ACPI Patcher反编译(D/C)。查找： Device (PEG) 找到后找最近的那个: Device (VID) 最后搜索并替换_DSM方法： Method (_DSM, 4, NotSerialized) { Store (Package (0x16) { "@0,compatible", Buffer (0x0B) { "NVDA,NVMac" }, "@0,device_type", Buffer (0x08) { "display" }, "@0,name", Buffer (0x0F) { "NVDA,Display-A" }, "@1,compatible", Buffer (0x0B) { "NVDA,NVMac" }, "@1,device_type", Buffer (0x08) [...]]]></description>
			<content:encoded><![CDATA[<p>这件事血黄血暴力了，手头只有10.6.3的安装光盘，用bootthink启动死活不行，都是直接重启。设置busratio＝17，成功但是五国。不想花费太多时间于是直接用TrueImage 把整个在Vostro上安装好的分区镜像过来，启动是用busratio＝17，并配上以下的kext，同时删除ATA相关Kext，启动成功。<span id="more-226"></span></p>
<ol>
<li> AppleACPIBatteryManager.kext 显示电池容量</li>
<li> AppleIntelE1000e.kext 内置网卡 </li>
</ol>
<p>声卡用VoodooHDA驱动没有问题，切记必须删除AppleHDA, LegacyHDA等，否则VoodooHDA不能工作。</p>
<p>最后是显卡，我的是独立显卡NV Quadro 3100M。采用前述Vostro 200方法安装可以进入，有QE/CI，但是无DH，查找外接显示器直接黑屏。最后解决方法是DSDT。首先用Everest生成DSDT，再用ACPI Patcher反编译(D/C)。查找：</p>
<pre>Device (PEG)
</pre>
<p>找到后找最近的那个:</p>
<pre>   Device (VID)
</pre>
<p>最后搜索并替换_DSM方法：</p>
<pre>Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x16)
                            {
                                "@0,compatible",
                                Buffer (0x0B)
                                {
                                    "NVDA,NVMac"
                                },

                                "@0,device_type",
                                Buffer (0x08)
                                {
                                    "display"
                                },

                                "@0,name",
                                Buffer (0x0F)
                                {
                                    "NVDA,Display-A"
                                },

                                "@1,compatible",
                                Buffer (0x0B)
                                {
                                    "NVDA,NVMac"
                                },

                                "@1,device_type",
                                Buffer (0x08)
                                {
                                    "display"
                                },

                                "@1,name",
                                Buffer (0x0F)
                                {
                                    "NVDA,Display-B"
                                },

                                "NVCAP",
                                Buffer (0x18)
                                {
                                    /* 0000 */    0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
                                    /* 0008 */    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
                                    /* 0010 */    0x00, 0x00, 0x00, 0x00
                                },

                                "VRAM,totalsize",
                                Buffer (0x04)
                                {
                                    0x00, 0x00, 0x00, 0x10
                                },

                                "device_type",
                                Buffer (0x0D)
                                {
                                    "NVDA,GeForce"
                                },

                                "model",
                                Buffer (0x19)
                                {
                                    "nVidia GeForce NVS 3100M"
                                },

                                "rom-revision",
                                Buffer (0x27)
                                {
                                    "nVidia GeForce NVS 3100M OpenGL Engine"
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }
</pre>
<p>用Patcher编译，注意必须勾选Apply Patches before compiling和DTGP Fix。将DSDT放到C:\Darwin，重启，完成！</p>
<p>最后是无线网卡，买了Asus N10用得还行，个子小虽小，功能挺全，这样就挺好，基本没啥可抱怨得。<strong> 升级10.6.4后，不用再设置busratio，说明对CPU支持得很好，然而悲剧的是网卡不支持64位，因此每次启动必须用-x32。还得贴狗皮膏药⋯⋯</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/07/21/t410%e5%ae%89%e8%a3%85macosx%ef%bc%88%e9%9d%9e%e5%b8%b8%e6%9a%b4%e5%8a%9b%e7%9a%84%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>宁静小城乌普萨拉</title>
		<link>http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/</link>
		<comments>http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 18:02:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[行走天下]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=192</guid>
		<description><![CDATA[Uppsala是瑞典第四大城市……不过以中国的标准，这也就算一个县城。总人口只有13万。不过，古时候这里是瑞典天主教的中心，斯堪的纳维亚的大主教驻锡此地，而瑞典最古老的Uppsala University也诞生于此。古老和现代在这个小城中结合得非常完美，既有现代风格的火车站及站前广场，又有古朴典雅的教堂。路上看不到行色匆匆。 同时这个小城也并不显得闭塞，在路上随处可见来自世界各地的人民，除了土生土长的北欧人之外，以土耳其人最多。长达16个小时的日照使得夏日的Uppsala充满活力。瑞典这个国家已经享受了近180年的和平，作为欧洲唯二的世外桃源，也许人民早已经忘记了什么事争执了吧。]]></description>
			<content:encoded><![CDATA[<p>Uppsala是瑞典第四大城市……不过以中国的标准，这也就算一个县城。总人口只有13万。不过，古时候这里是瑞典天主教的中心，斯堪的纳维亚的大主教驻锡此地，而瑞典最古老的Uppsala University也诞生于此。古老和现代在这个小城中结合得非常完美，既有现代风格的火车站及站前广场，又有古朴典雅的教堂。路上看不到行色匆匆。</p>
<p><br class="spacer_" /></p>
<p>同时这个小城也并不显得闭塞，在路上随处可见来自世界各地的人民，除了土生土长的北欧人之外，以土耳其人最多。长达16个小时的日照使得夏日的Uppsala充满活力。瑞典这个国家已经享受了近180年的和平，作为欧洲唯二的世外桃源，也许人民早已经忘记了什么事争执了吧。</p>
<p><br class="spacer_" /></p>

<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0674/' title='Fyris River (Fyrisån)（2）'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0674-150x150.jpg" class="attachment-thumbnail" alt="Fyris River (Fyrisån)（2）" title="Fyris River (Fyrisån)（2）" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0675/' title='Fyris River (Fyrisån)'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0675-150x150.jpg" class="attachment-thumbnail" alt="Fyris River (Fyrisån)" title="Fyris River (Fyrisån)" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0676/' title='后街小巷'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0676-150x150.jpg" class="attachment-thumbnail" alt="后街小巷" title="后街小巷" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0678/' title='远看Uppsala大教堂尖顶'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0678-150x150.jpg" class="attachment-thumbnail" alt="远看Uppsala大教堂尖顶" title="远看Uppsala大教堂尖顶" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0679/' title='Uppsala大学礼堂内部'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0679-150x150.jpg" class="attachment-thumbnail" alt="Uppsala大学礼堂内部" title="Uppsala大学礼堂内部" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0680/' title='Uppsala大学礼堂的穹顶'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0680-150x150.jpg" class="attachment-thumbnail" alt="Uppsala大学礼堂的穹顶" title="Uppsala大学礼堂的穹顶" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0684/' title='近看Uppsala大教堂尖顶'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0684-150x150.jpg" class="attachment-thumbnail" alt="近看Uppsala大教堂尖顶" title="近看Uppsala大教堂尖顶" /></a>
<a href='http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/img_0690/' title='Uppsala 火车站前广场'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0690-150x150.jpg" class="attachment-thumbnail" alt="Uppsala 火车站前广场" title="Uppsala 火车站前广场" /></a>

<p><br class="spacer_" /></p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Eu7k25GjMVw&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Eu7k25GjMVw&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/07/13/%e5%ae%81%e9%9d%99%e5%b0%8f%e5%9f%8e%e4%b9%8c%e6%99%ae%e8%90%a8%e6%8b%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>欧洲真是环保……机场热得不行</title>
		<link>http://blog.kyloo.net/2010/07/11/%e6%ac%a7%e6%b4%b2%e7%9c%9f%e6%98%af%e7%8e%af%e4%bf%9d%e2%80%a6%e2%80%a6%e6%9c%ba%e5%9c%ba%e7%83%ad%e5%be%97%e4%b8%8d%e8%a1%8c/</link>
		<comments>http://blog.kyloo.net/2010/07/11/%e6%ac%a7%e6%b4%b2%e7%9c%9f%e6%98%af%e7%8e%af%e4%bf%9d%e2%80%a6%e2%80%a6%e6%9c%ba%e5%9c%ba%e7%83%ad%e5%be%97%e4%b8%8d%e8%a1%8c/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 07:42:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[行走天下]]></category>
		<category><![CDATA[旅行]]></category>

		<guid isPermaLink="false">http://blog.kyloo.net/?p=182</guid>
		<description><![CDATA[在阿姆斯特丹机场热得汗流浃背……欧洲真是环保，空调都舍不得开。]]></description>
			<content:encoded><![CDATA[<p>在阿姆斯特丹机场热得汗流浃背……欧洲真是环保，空调都舍不得开。</p>

<a href='http://blog.kyloo.net/2010/07/11/%e6%ac%a7%e6%b4%b2%e7%9c%9f%e6%98%af%e7%8e%af%e4%bf%9d%e2%80%a6%e2%80%a6%e6%9c%ba%e5%9c%ba%e7%83%ad%e5%be%97%e4%b8%8d%e8%a1%8c/img_0671/' title='阿姆斯特丹机场'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0671-150x150.jpg" class="attachment-thumbnail" alt="阿姆斯特丹机场等候转机中" title="阿姆斯特丹机场" /></a>
<a href='http://blog.kyloo.net/2010/07/11/%e6%ac%a7%e6%b4%b2%e7%9c%9f%e6%98%af%e7%8e%af%e4%bf%9d%e2%80%a6%e2%80%a6%e6%9c%ba%e5%9c%ba%e7%83%ad%e5%be%97%e4%b8%8d%e8%a1%8c/img_0672/' title='阿姆斯特丹候机大厅2'><img width="150" height="150" src="http://blog.kyloo.net/wp-content/uploads/2010/07/IMG_0672-150x150.jpg" class="attachment-thumbnail" alt="阿姆斯特丹候机大厅2" title="阿姆斯特丹候机大厅2" /></a>

<p><br class="spacer_" /></p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_186" class="wp-caption aligncenter" style="width: 1034px;">
<dt class="wp-caption-dt"></dt>
<dd class="wp-caption-dd"> </dd>
</dl>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.kyloo.net/2010/07/11/%e6%ac%a7%e6%b4%b2%e7%9c%9f%e6%98%af%e7%8e%af%e4%bf%9d%e2%80%a6%e2%80%a6%e6%9c%ba%e5%9c%ba%e7%83%ad%e5%be%97%e4%b8%8d%e8%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

