<?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>右舷 &#187; 善其事</title>
	<atom:link href="http://www.laihj.net/category/%e4%bb%a3%e7%a0%81/%e5%96%84%e5%85%b6%e4%ba%8b/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.laihj.net</link>
	<description>list(linux,emacs,旅行,读书,andriod,MacOS,iOS)</description>
	<lastBuildDate>Tue, 27 Dec 2011 12:54:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>kal iphone日历控件</title>
		<link>http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/</link>
		<comments>http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:35:53 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[kal]]></category>
		<category><![CDATA[日历控件]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650439</guid>
		<description><![CDATA[不废话，先上图

自带的例子演示了三种数据源的用法：iphone自带日历，json和sqlite.
githut地址:https://github.com/klazuka/Kal
Related Posts[ios] shareKit,三行代码分享到社交媒体(1)
[iphone] 饼图配色初级(0)
[ios]简单的饼图代码推荐(0)
[ios note]实现UITextView的圆角(0)
[ios note] view(0)
[ios note] windows(0)
Recent Comments]]></description>
			<content:encoded><![CDATA[<p>不废话，先上图</p>
<p><img class="aligncenter size-full wp-image-650440" title="kal" src="http://www.laihj.net/wp-content/uploads/2011/08/kal.png" alt="kal" width="321" height="481" /></p>
<p>自带的例子演示了三种数据源的用法：iphone自带日历，json和sqlite.</p>
<p>githut地址:https://github.com/klazuka/Kal</p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios] shareKit,三行代码分享到社交媒体</title>
		<link>http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/</link>
		<comments>http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 04:35:26 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650394</guid>
		<description><![CDATA[shareKit是一枚ios上的分享库，支持分享文字，URL，图片和文件（取决于目标媒体是否支持）。
操作相当简单，只要三行代码。

?View Code C- &#40;void&#41;myButtonHandlerAction
&#123;
	// Create the item to share (in this example, a url)
	NSURL *url = &#91;NSURL URLWithString:@&#34;http://getsharekit.com&#34;&#93;;
	SHKItem *item = &#91;SHKItem URL:url title:@&#34;ShareKit is Awesome!&#34;&#93;;
&#160;
	// Get the ShareKit action sheet
	SHKActionSheet *actionSheet = &#91;SHKActionSheet actionSheetForItem:item&#93;;
&#160;
	// Display the action sheet
	&#91;actionSheet showFromToolbar:navigationController.toolbar&#93;;
&#125;


详细文档
Related Posts[ios]简单的饼图代码推荐(0)
[ios note]实现UITextView的圆角(0)
[ios note] view(0)
[ios note] windows(0)
kal iphone日历控件(0)
ios blocks 相关存档(0)
[iphone] 饼图配色初级(0)
[ios note] SQLite Tutorial(0)
Recent Commentsfoun : 不知所云。
http://fur.ly/5g3g
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.getsharekit.com/">shareKit</a>是一枚ios上的分享库，支持分享文字，URL，图片和文件（取决于目标媒体是否支持）。</p>
<p>操作相当简单，只要三行代码。</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p650394code2'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6503942"><td class="code" id="p650394code2"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>myButtonHandlerAction
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Create the item to share (in this example, a url)</span>
	NSURL <span style="color: #339933;">*</span>url <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSURL URLWithString<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;http://getsharekit.com&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	SHKItem <span style="color: #339933;">*</span>item <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>SHKItem URL<span style="color: #339933;">:</span>url title<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;ShareKit is Awesome!&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Get the ShareKit action sheet</span>
	SHKActionSheet <span style="color: #339933;">*</span>actionSheet <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>SHKActionSheet actionSheetForItem<span style="color: #339933;">:</span>item<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Display the action sheet</span>
	<span style="color: #009900;">&#91;</span>actionSheet showFromToolbar<span style="color: #339933;">:</span>navigationController.<span style="color: #202020;">toolbar</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><img title="actionSheet.png" src="http://www.getsharekit.com/i/install/actionSheet.png" border="0" alt="actionSheet.png" /></p>
<p><a href="http://www.getsharekit.com/docs/">详细文档</a></p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/" title="[ios note] SQLite Tutorial 2010.12.30">[ios note] SQLite Tutorial</a>(0)</li>
</ul><h3>Recent Comments</h3><ul><li><a class="commentor" href="" >foun</a> : <a class="comment_content" href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/#comment-1196" title="View the entire comment by foun" >不知所云。
http://fur.ly/5g3g</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iTimeLog的输入部分</title>
		<link>http://www.laihj.net/2011/03/itimelog-input/</link>
		<comments>http://www.laihj.net/2011/03/itimelog-input/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 13:10:03 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[负暄琐话]]></category>
		<category><![CDATA[itimelog]]></category>
		<category><![CDATA[timelog]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650368</guid>
		<description><![CDATA[iTimeLog是为了解决一个问题而出现的，当你晚上躺在床上准备睡觉的时候，你觉得这一天过得怎么样？
这个问题可以分成两个部分：第一，你的都做了哪些事，各花了多少时间？第二，这些时间都是值得的吗，这些事都是需要做的吗？
为了回答这两个问题，你必须记录下你的时间花费。
现在app store上已经有几个时间记录的软件了，但我觉得它们有一点做得不够，就是减少输入的复杂性。这也是iTimeLog存在的原因，iTimeLog的设计方向就是不断地减少输入复杂性，让输入尽量简单，减少记录时间的额外花销。

为了达到这个目的，iTimeLog的整个输入界面布局设计跟iphone的短信界面差不多，采用界面底部输入框的方式，输入事件后点击号即可开始一个事件，记录开始时间，完成一件事情后，点击事件上的即可打上完成时间，并自动算出耗时多少。但点击的操作方式即不是必需的也不被鼓励，iTimeLog遵循一时一事的原则，开始新的事件的同时，会自动停止上一事件，也就是说，在流式的工作中，只需在开始做一件事的时候，在iTimeLog中输入一个事件即可，其它的工作iTimeLog会自动完成。
人在江湖，总有工作被打断的时候，比如在编码时收到电话说用户又懒得查手册了，这时停下来帮忙查手册已然不舒服，时间紧迫也不能慢悠悠地写事件记录。所以iTimeLog允许不输入任何文字的情况下直接点击，这相当于先打一个时间戳，之后有时间再回头进行编辑。
对大部分人来说，一天所做的事多是重复的。比如一个标准的码农，一天的事大概就是起床－吃饭－编码－游戏－编码－看书－吃饭－睡－编码－吃饭－看书－游戏－睡。
因此iTimeLog在每一个事件记录上都放了一个按钮，如果一个事件在屏幕上显示，只需点击就可以开始它，而不需要调出键盘重新输入。比如“编码－游戏－编码”事件串，当玩完游戏重新开始编码的时候，它就可以了。

Related PostsiTimeLog的分类与四象限法(5)
Recent Commentslaihj : anTimeLog应该可以下载啊，最近没有什么改动。

ios的默认控件是比android精致一...
kiteinfalls : antimelog在市场上无法下载了，为什么ios上的东西都比android上的东西精致呢，对了，这...
]]></description>
			<content:encoded><![CDATA[<p>iTimeLog是为了解决一个问题而出现的，当你晚上躺在床上准备睡觉的时候，你觉得这一天过得怎么样？</p>
<p>这个问题可以分成两个部分：第一，<a href="http://www.lixiaolai.com/?p=429">你的都做了哪些事，各花了多少时间</a>？第二，<a href="http://dongxi.net/b04zJ">这些时间都是值得的吗，这些事都是需要做的吗</a>？</p>
<p>为了回答这两个问题，你必须记录下你的时间花费。</p>
<p>现在app store上已经有几个时间记录的软件了，但我觉得它们有一点做得不够，就是减少输入的复杂性。这也是iTimeLog存在的原因，iTimeLog的设计方向就是不断地减少输入复杂性，让输入尽量简单，减少记录时间的额外花销。</p>
<p><img class="aligncenter size-full wp-image-650378" title="1" src="http://www.laihj.net/wp-content/uploads/2011/03/1.png" alt="1" width="320" height="480" /></p>
<p>为了达到这个目的，iTimeLog的整个输入界面布局设计跟iphone的短信界面差不多，采用界面底部输入框的方式，输入事件后点击<img class="alignnone size-full wp-image-650371" title="add" src="http://www.laihj.net/wp-content/uploads/2011/03/add.png" alt="add" width="25" height="23" />号即可开始一个事件，记录开始时间，完成一件事情后，点击事件上的<img class="alignnone size-full wp-image-650372" title="done" src="http://www.laihj.net/wp-content/uploads/2011/03/done.png" alt="done" width="29" height="19" />即可打上完成时间，并自动算出耗时多少。但点击<img class="alignnone size-full wp-image-650372" title="done" src="http://www.laihj.net/wp-content/uploads/2011/03/done.png" alt="done" width="29" height="19" />的操作方式即不是必需的也不被鼓励，iTimeLog遵循一时一事的原则，开始新的事件的同时，会自动停止上一事件，也就是说，在流式的工作中，只需在开始做一件事的时候，在iTimeLog中输入一个事件即可，其它的工作iTimeLog会自动完成。</p>
<p>人在江湖，总有工作被打断的时候，比如在编码时收到电话说用户又懒得查手册了，这时停下来帮忙查手册已然不舒服，时间紧迫也不能慢悠悠地写事件记录。所以iTimeLog允许不输入任何文字的情况下直接点击<img class="alignnone size-full wp-image-650371" title="add" src="http://www.laihj.net/wp-content/uploads/2011/03/add.png" alt="add" width="28" height="26" />，这相当于先打一个时间戳，之后有时间再回头进行编辑。</p>
<p>对大部分人来说，一天所做的事多是重复的。比如一个标准的码农，一天的事大概就是起床－吃饭－编码－游戏－编码－看书－吃饭－睡－编码－吃饭－看书－游戏－睡。</p>
<p>因此iTimeLog在每一个事件记录上都放了一个<img class="alignnone size-full wp-image-650373" title="redo" src="http://www.laihj.net/wp-content/uploads/2011/03/redo.png" alt="redo" width="25" height="21" />按钮，如果一个事件在屏幕上显示，只需点击<img class="alignnone size-full wp-image-650373" title="redo" src="http://www.laihj.net/wp-content/uploads/2011/03/redo.png" alt="redo" width="25" height="21" />就可以开始它，而不需要调出键盘重新输入。比如“编码－游戏－编码”事件串，当玩完游戏重新开始编码的时候，<img class="alignnone size-full wp-image-650373" title="redo" src="http://www.laihj.net/wp-content/uploads/2011/03/redo.png" alt="redo" width="25" height="21" />它就可以了。</p>
<p style="text-align: center;"><a rel="http://itunes.apple.com/us/app/itimelog/id423263073?mt=8" href="http://itunes.apple.com/us/app/itimelog/id423263073?mt=8" target="_blank"><img class="size-full wp-image-650362 aligncenter" title="app-store" src="http://www.laihj.net/wp-content/uploads/2011/03/app-store.png" alt="app-store" width="183" height="60" /></a></p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/05/type-of-itimelog/" title="iTimeLog的分类与四象限法 2011.05.15">iTimeLog的分类与四象限法</a>(5)</li>
</ul><h3>Recent Comments</h3><ul><li><a class="commentor" href="" >laihj</a> : <a class="comment_content" href="http://www.laihj.net/2011/03/itimelog-input/#comment-1197" title="View the entire comment by laihj" >anTimeLog应该可以下载啊，最近没有什么改动。

ios的默认控件是比android精致一...</a></li>
<li><a class="commentor" href="" >kiteinfalls</a> : <a class="comment_content" href="http://www.laihj.net/2011/03/itimelog-input/#comment-1191" title="View the entire comment by kiteinfalls" >antimelog在市场上无法下载了，为什么ios上的东西都比android上的东西精致呢，对了，这...</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/03/itimelog-input/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[iphone] 饼图配色初级</title>
		<link>http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/</link>
		<comments>http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 08:47:03 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[pie]]></category>
		<category><![CDATA[配色]]></category>
		<category><![CDATA[饼图]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650355</guid>
		<description><![CDATA[
目前正在进行中的项目需要用到饼图，参考初级的配色教程做了一个初级的配色方案。在使用随机配色的情况下，看上去并不会差到难以忍受的程度，虽然肯定比不上专业设计。上图是相同数据在iphone模拟器上的显示。
做法如下：
1.准备色盘，色盘我直接使用上面提到的教程上那个标准色盘，教程中有八级亮度的色盘可选，当然也可以准备别的色盘。在代码中使用包含12个UIColor的数组。
2.初始色：初始色是指第一个选中的颜色，我取（1－12）的随机数。考虑到用户数据可能不多，饼图的分区可能偏少等因素，不想使用固定的初始值，防止用户每次打开饼图都看到同样的配色。
3.确定分区取色规则。（设定色盘为一个数组）

一个分区：取初始色
两个分区：取初始色和对角色（即初始色＋6）
三个分区：初始色，初始色＋4，初始色＋8

以此类推，设定一到六个分区的取法，七到十一个分区，使用一到一个分区的补集。
即，十一个分区：色盘减去一初始色。
十个分区：色盘减去初始色和其对角色。
其它：整个配色的冷暖明暗，我个人觉得跟最大的扇形区选色有关，我的做法是最大的扇区使用初始色，所以如果我想控制饼图，令整体色调偏暖，可以把初始色的随机值控制在几个暖色上。
Related Posts[ios]简单的饼图代码推荐(0)
kal iphone日历控件(0)
[ios] shareKit,三行代码分享到社交媒体(1)
[ios note]实现UITextView的圆角(0)
[ios note] view(0)
[ios note] windows(0)
Recent Comments]]></description>
			<content:encoded><![CDATA[<p><a title="View 'pie3' on Flickr.com" href="http://www.flickr.com/photos/56438362@N05/5379816945"><img title="pie3" src="http://farm6.static.flickr.com/5167/5379816945_96cf649311.jpg" border="0" alt="pie3" width="321" height="419" /></a><a title="View 'pie1' on Flickr.com" href="http://www.flickr.com/photos/56438362@N05/5379816203"><img title="pie1" src="http://farm6.static.flickr.com/5084/5379816203_3f7ec95db3.jpg" border="0" alt="pie1" width="317" height="415" /></a><img title="pie2" src="http://farm6.static.flickr.com/5004/5380418448_dfae322efd.jpg" border="0" alt="pie2" width="322" height="417" /></p>
<p>目前正在进行中的项目需要用到饼图，参考<a href="http://vector.tutsplus.com/articles/theory/open-the-door-into-the-science-of-color-theory/">初级的配色教程</a>做了一个初级的配色方案。在使用随机配色的情况下，看上去并不会差到难以忍受的程度，虽然肯定比不上专业设计。上图是相同数据在iphone模拟器上的显示。</p>
<p>做法如下：</p>
<p>1.准备色盘，色盘我直接使用上面提到的教程上那个标准色盘，教程中有八级亮度的色盘可选，当然也可以准备别的色盘。在代码中使用包含12个UIColor的数组。</p>
<p>2.初始色：初始色是指第一个选中的颜色，我取（1－12）的随机数。考虑到用户数据可能不多，饼图的分区可能偏少等因素，不想使用固定的初始值，防止用户每次打开饼图都看到同样的配色。</p>
<p>3.确定分区取色规则。（设定色盘为一个数组）</p>
<ul>
<li>一个分区：取初始色</li>
<li>两个分区：取初始色和对角色（即初始色＋6）</li>
<li>三个分区：初始色，初始色＋4，初始色＋8</li>
</ul>
<p>以此类推，设定一到六个分区的取法，七到十一个分区，使用一到一个分区的补集。</p>
<p>即，十一个分区：色盘减去一初始色。</p>
<p>十个分区：色盘减去初始色和其对角色。</p>
<p>其它：整个配色的冷暖明暗，我个人觉得跟最大的扇形区选色有关，我的做法是最大的扇区使用初始色，所以如果我想控制饼图，令整体色调偏暖，可以把初始色的随机值控制在几个暖色上。</p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios]简单的饼图代码推荐</title>
		<link>http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/</link>
		<comments>http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 04:01:49 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[饼图]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650351</guid>
		<description><![CDATA[
在iphone上画报表，有收费的方案，一般开源的推荐就是：
不过，如果你只是想画饼图，同时也不想给自己找太多麻烦，或是项目时间太紧，可以试试以下这个简单的方案。
代码来自 cocoachina.com
使用这段代码有常见的两个问题的解决方案
1：阴影
如果你不想要原来代码中的阴影，搜&#8221;CGFloat CGGradientCreateWithColorComponents&#8220;，把第二个参数改成nil。

CGGradientRef gradient = CGGradientCreateWithColorComponents(colorspace, nil, nil, 2);


2.缺角
当你做了第一步之后，会发现饼缺一个角，这应该是一个Bug.
搜”只有弧度《 3.14 的才会画前面的厚度”把else中的break改成continue.
 
Related Posts[ios] shareKit,三行代码分享到社交媒体(1)
[iphone] 饼图配色初级(0)
[ios note]实现UITextView的圆角(0)
[ios note] view(0)
[ios note] windows(0)
kal iphone日历控件(0)
ios blocks 相关存档(0)
[ios note] SQLite Tutorial(0)
Recent Comments]]></description>
			<content:encoded><![CDATA[<p><a title="View '屏幕快照 2011-01-10 上午11.45.25' on Flickr.com" href="http://www.flickr.com/photos/56438362@N05/5341208747"><img title="屏幕快照 2011-01-10 上午11.45.25" src="http://farm6.static.flickr.com/5050/5341208747_bdd92c35b5.jpg" border="0" alt="屏幕快照 2011-01-10 上午11.45.25" width="321" height="361" /></a></p>
<p>在iphone上画报表，有收费的方案，一般开源的推荐就是：</p>
<p>不过，如果你只是想画饼图，同时也不想给自己找太多麻烦，或是项目时间太紧，可以试试以下这个简单的方案。</p>
<p>代码来自 <a href="http://www.cocoachina.com/bbs/read.php?tid-33615-fpage-5.html">cocoachina.com</a></p>
<p>使用这段代码有常见的两个问题的解决方案</p>
<p>1：阴影</p>
<p>如果你不想要原来代码中的阴影，搜&#8221;<span><span style="color: #3a61f6;">CGFloat</span></span><span style="color: #3a61f6;"> CGGradientCreateWithColorComponents</span>&#8220;，把第二个参数改成nil。</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #b0e35d;"><span style="color: #3d68f6;">CGGradientRef</span><span style="color: #f9f9f4;"><span style="color: #3d68f6;"> gradient = </span></span><span style="color: #3d68f6;">CGGradientCreateWithColorComponents</span><span style="color: #f9f9f4;"><span style="color: #3d68f6;">(colorspace, </span></span><span style="color: #d8b583;"><span style="color: #3d68f6;">nil</span></span><span style="color: #f9f9f4;"><span style="color: #3d68f6;">, </span></span><span style="color: #d8b583;"><span style="color: #3d68f6;">nil</span></span><span style="color: #f9f9f4;"><span style="color: #3d68f6;">, </span></span><span style="color: #bf9bf8;"><span style="color: #3d68f6;">2</span></span><span style="color: #f9f9f4;"><span style="color: #3d68f6;">);</span></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #f9f9f4;"><span style="color: #3a61f6;"><br /></span></p>
</blockquote>
<p>2.缺角</p>
<p>当你做了第一步之后，会发现饼缺一个角，这应该是一个Bug.</p>
<p>搜”<span style="font-family: 'Heiti SC Light'; font-size: 12px;"><span style="color: #3e70f6;">只有弧度《</span></span><span style="font-family: 'Heiti SC Light'; font-size: 12px;"><span style="font: 12.0px Monaco;"><span style="color: #3e70f6;"> 3.14 </span></span></span><span style="font-family: 'Heiti SC Light'; font-size: 12px;"><span style="color: #3e70f6;">的才会画前面的厚度”</span>把else中的break改成continue.</span></p>
<p> </p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/" title="[ios note] SQLite Tutorial 2010.12.30">[ios note] SQLite Tutorial</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios note]实现UITextView的圆角</title>
		<link>http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/</link>
		<comments>http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 11:00:16 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[UITextView]]></category>
		<category><![CDATA[圆角]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650345</guid>
		<description><![CDATA[
UITextView用于显示和输入大段文字，没有设置圆角的属性，跟UITextField不一致，在既有UITextField又有UITextView的界面中显得很突兀。
实现UITextView圆角的方法是借助UITextView的layer.原码如下：
foobar.h

#import &#60;QuartzCore/QuartzCore.h&#62;

foobar.m

 note.layer.cornerRadius = 6;
 note.layer.masksToBounds = YES;


效果：

 
Related Posts[ios] shareKit,三行代码分享到社交媒体(1)
[ios]简单的饼图代码推荐(0)
[ios note] view(0)
[ios note] windows(0)
kal iphone日历控件(0)
ios blocks 相关存档(0)
[iphone] 饼图配色初级(0)
[ios note] SQLite Tutorial(0)
Recent Comments]]></description>
			<content:encoded><![CDATA[<p><a title="View '屏幕快照 2011-01-06 下午06.46.31' on Flickr.com" href="http://www.flickr.com/photos/56438362@N05/5329357985"><img title="屏幕快照 2011-01-06 下午06.46.31" src="http://farm6.static.flickr.com/5206/5329357985_9d04c8f681.jpg" border="0" alt="屏幕快照 2011-01-06 下午06.46.31" width="293" height="207" /></a></p>
<p>UITextView用于显示和输入大段文字，没有设置圆角的属性，跟UITextField不一致，在既有UITextField又有UITextView的界面中显得很突兀。</p>
<p>实现UITextView圆角的方法是借助UITextView的layer.原码如下：</p>
<p>foobar.h</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #e73e4b;"><span style="color: #888373;">#import </span>&lt;QuartzCore/QuartzCore.h&gt;</p>
</blockquote>
<p>foobar.m</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #00fdfe;"><span style="color: #f9f9f4;"><span style="white-space: pre;"> </span></span><span style="color: #3a61f6;">note</span><span style="color: #f9f9f4;"><span style="color: #3a61f6;">.</span></span><span style="color: #3a61f6;">layer</span><span style="color: #f9f9f4;"><span style="color: #3a61f6;">.</span></span><span style="color: #3a61f6;">cornerRadius</span><span style="color: #f9f9f4;"><span style="color: #3a61f6;"> =</span></span><span style="color: #f9f9f4;"> </span><span style="color: #bf9bf8;">6</span><span style="color: #f9f9f4;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #00fdfe;"><span style="color: #f9f9f4;"><span style="white-space: pre;"> </span></span><span style="color: #3053f5;">note</span><span style="color: #f9f9f4;"><span style="color: #3356f5;">.</span></span><span style="color: #3356f5;">layer</span><span style="color: #f9f9f4;"><span style="color: #3356f5;">.</span></span><span style="color: #3356f5;">masksToBounds</span><span style="color: #f9f9f4;"><span style="color: #3356f5;"> =</span></span><span style="color: #f9f9f4;"> </span><span style="color: #d8b583;">YES</span><span style="color: #f9f9f4;">;</span></p>
</blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #00fdfe;"><span style="color: #f9f9f4;"><br /></span></p>
<p>效果：</p>
<p><a title="View '屏幕快照 2011-01-06 下午06.45.57' on Flickr.com" href="http://www.flickr.com/photos/56438362@N05/5329358911"><img title="屏幕快照 2011-01-06 下午06.45.57" src="http://farm6.static.flickr.com/5287/5329358911_7945081046.jpg" border="0" alt="屏幕快照 2011-01-06 下午06.45.57" width="301" height="215" /></a></p>
<p> </p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/" title="[ios note] SQLite Tutorial 2010.12.30">[ios note] SQLite Tutorial</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios note] SQLite Tutorial</title>
		<link>http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/</link>
		<comments>http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 15:42:37 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650341</guid>
		<description><![CDATA[
SQLite Tutorial – Displaying data in a UITableView
SQLite Tutorial – Deleting data from UITableView.
SQLite Tutorial – Inserting data into SQLite database.
SQLite Tutorial – Loading data as required.
SQLite Tutorial – Updating data in SQLite database.
SQLite Tutorial – Saving images in the database

Related Posts[ios note] windows(0)
ios blocks 相关存档(0)
[ios] shareKit,三行代码分享到社交媒体(1)
[ios]简单的饼图代码推荐(0)
[ios note]实现UITextView的圆角(0)
[ios note] view(0)
Recent Comments]]></description>
			<content:encoded><![CDATA[<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 25px; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; list-style-type: disc; list-style-position: initial; list-style-image: initial; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;">
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-selecting-data.html">SQLite Tutorial – Displaying data in a UITableView</a></li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-deleting-data.html">SQLite Tutorial – Deleting data from UITableView.</a></li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-adding-data.html">SQLite Tutorial – Inserting data into SQLite database.</a></li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-loading-data-as.html">SQLite Tutorial – Loading data as required.</a></li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2008/11/sqlite-tutorial-updating-data.html">SQLite Tutorial – Updating data in SQLite database.</a></li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #225e9b; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.iphonesdkarticles.com/2009/02/sqlite-tutorial-saving-images-in.html">SQLite Tutorial – Saving images in the database</a></li>
</ul>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios note] view</title>
		<link>http://www.laihj.net/2010/12/ios-note-view/</link>
		<comments>http://www.laihj.net/2010/12/ios-note-view/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 12:32:04 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650339</guid>
		<description><![CDATA[http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW6
view是程序与用户交流的主要方式。

布局管理subviews

定义自己的resize行为
管理一系列subviews
override  subviews的大小的位置
转化自己的坐标系和window的坐标系


绘图和动画

在矩形区绘图
某些view变化时的直通车


事件处理

接收touch事件
参与responder chain



新建和配置view
用IB或手动创建view，然后加到view hierachies中用。
最简单的做法是在IB中用图型化的方法来处理。
在IB中，你可添加view，分配到hierachies中，配置它们，把view的行为跟代码关联起来。
一般来说，在IB中看到的跟运行时看到的一样。
做完后保存为nib file，这个文件保存对象的状态和配置。
 用nib file来保存某个view controller对应的所有view
 nib file中最顶级的view用来描述viewcontroller.view
 顶级的view应该跟设备屏幕一样大。很少有用nib file来保存部分view的。
nib file跟view controller一起用的时候，需要用nib file的信息来实始化view controller.
系统会在合适的时候载入或去掉你的view。
如果你的nib file并没有跟一个view controller关联，也可以在代码中载入它，通过 NSBundle or UINib 对象。
 
 手动
 
 使用标准的allocation/initialization pattern.
 默认初始化view的方法是initWithFrame: 设定它在父view中的大小和位置。
示列：




CGRect  viewRect = CGRectMake(0, 0, 100, 100);





UIView* myView = [[UIView alloc] initWithFrame:viewRect];





 
然后把它加入父view中,见“Adding and Removing Subviews.”

 view的属性
 属性控制显示和行为
 见 UIView Class Reference.
可以用 view的tag属性做标记，方便在代码中实时地访问view
tag值默认为0
使用UIView的 viewWithTag:方法来检索。
 它使用深度优先的算法检索当前view和它的子view(view层级是树状的）



新建和配置view层级
管理view层级是关键动作
包括显示和行为

上图为典型的结构。
还是一样，可以用IB或手动来做层级管理。
添加和删除subview
IB是最方使的方法，所见即所得。拖动扣作。
手动

添加subview  addSubview: 
插入subview insertSubView开头三方法  可指定位置
重排subview
移除subview

 把subview插入到view时，大小超出view的部分不自动截断。
 [...]]]></description>
			<content:encoded><![CDATA[<div><a href="file:///Users/laihj/Library/Application%20Support/Evernote/data/51783/content/p293/(null)"><br />http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW6</a></div>
<p>view是程序与用户交流的主要方式。</p>
<ul>
<li>布局管理subviews
<ul>
<li>定义自己的resize行为</li>
<li>管理一系列subviews</li>
<li>override  subviews的大小的位置</li>
<li>转化自己的坐标系和window的坐标系</li>
</ul>
</li>
<li>绘图和动画
<ul>
<li>在矩形区绘图</li>
<li>某些view变化时的直通车</li>
</ul>
</li>
<li>事件处理
<ul>
<li>接收touch事件</li>
<li>参与responder chain</li>
</ul>
</li>
</ul>
<p>新建和配置view</p>
<div>用IB或手动创建view，然后加到view hierachies中用。</div>
<div>最简单的做法是在IB中用图型化的方法来处理。</div>
<div>在IB中，你可添加view，分配到hierachies中，配置它们，把view的行为跟代码关联起来。</div>
<div>一般来说，在IB中看到的跟运行时看到的一样。</div>
<div>做完后保存为nib file，这个文件保存对象的状态和配置。</div>
<div><em> 用nib file来保存某个view controller对应的所有view</em></div>
<div><em> nib file中最顶级的view用来描述viewcontroller.view</em></div>
<div><em> 顶级的view应该跟设备屏幕一样大。很少有用nib file来保存部分view的。</em></div>
<div>nib file跟view controller一起用的时候，需要用nib file的信息来实始化view controller.</div>
<div>系统会在合适的时候载入或去掉你的view。</div>
<div>如果你的nib file并没有跟一个view controller关联，也可以在代码中载入它，通过 <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html#//apple_ref/occ/cl/NSBundle" target="_self">NSBundle</a></code> or <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UINib_Ref/Reference/Reference.html#//apple_ref/occ/cl/UINib" target="_self">UINib</a></code> 对象。</div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> </span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 手动</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> </span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 使用标准的</span><span style="color: #3366cc; text-decoration: none; font-style: normal; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #3366cc; white-space: nowrap; cursor: pointer;"><a style="color: #3366cc; text-decoration: none; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #3366cc;" href="http://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectCreation.html#//apple_ref/doc/uid/TP40008195-CH39" target="_self">allocation/initialization pattern</a></span>.</div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 默认初始化view的方法是</span><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/initWithFrame:" target="_self">initWithFrame:</a> 设定它在父view中的大小和位置。</div>
<div>示列：</div>
<table style="width: 403px; background-color: #f1f5f9; border-collapse: collapse; padding-bottom: 4px; border: 1px solid #c7cfd5;">
<tbody>
<tr style="border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: #ffffff;">
<td style="padding: 0.5em;">
<pre style="margin-top: -0.083em; margin-bottom: 0px; font-size: 12px; font-family: Courier, Consolas, monospace; color: #666666; margin-right: 0.333em; margin-left: 0.5em; line-height: 13px; white-space: pre-wrap;">CGRect  viewRect = CGRectMake(0, 0, 100, 100);
</pre>
</td>
</tr>
<tr style="border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: #ffffff;">
<td style="padding: 0.5em;">
<pre style="margin-top: -0.083em; margin-bottom: 0px; font-size: 12px; font-family: Courier, Consolas, monospace; color: #666666; margin-right: 0.333em; margin-left: 0.5em; line-height: 13px; white-space: pre-wrap;">UIView* myView = [[UIView alloc] initWithFrame:viewRect];
</pre>
</td>
</tr>
</tbody>
</table>
<p> </p>
<div>然后把它加入父view中,见<span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW11">“Adding and Removing Subviews.”</a></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><br /></span></div>
<div><span style="border-collapse: separate; color: #000000; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW11"></a></span><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> view的属性</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 属性控制显示和行为</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 见 </span><em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816" target="_self">UIView Class Refe</a></em><em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816" target="_self">rence</a></em>.</div>
<div>可以用 view的tag属性做标记，方便在代码中实时地访问view</div>
<div>tag值默认为0</div>
<div>使用UIView的 <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/viewWithTag:" target="_self">viewWithTag:</a><span style="color: #000800;">方法来检索。</span></code></div>
<div><code style="font-size: 13px; font-family: Courier, Consolas, monospace;"><span style="color: #000800;"> 它使用深度优先的算法检索当前view和它的子view(view层级是树状的）</span></code></div>
<div>
<div></p>
<div></p>
<div>新建和配置view层级</div>
<div>管理view层级是关键动作</div>
<div>包括显示和行为</div>
<div><img src="file:///Users/laihj/Library/Application%20Support/Evernote/data/51783/content/p293/4b739a66ada4e1f2ba1f737bd5f038e4.jpeg" alt="" width="469" height="333" /></div>
<div>上图为典型的结构。</div>
<div>还是一样，可以用IB或手动来做层级管理。</div>
<div>添加和删除subview</div>
<div>IB是最方使的方法，所见即所得。拖动扣作。</div>
<div>手动</div>
<ul>
<li>添加subview  <span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/addSubview:" target="_self">addSubview:</a></code> </span></span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">插入subview insertSubView开头三方法  可指定位置</span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">重排subview</span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">移除subview</span></li>
</ul>
<p><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 把subview插入到view时，大小超出view的部分不自动截断。</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 如果要截断，手动设<span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: 13px;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/clipsToBounds" target="_self">clipsToBounds</a></span></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="color: #666666; font-family: Courier, Consolas, monospace;"><br /></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><a style="text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/clipsToBounds" target="_self"></a></span><span style="color: #666666; font-family: Courier, Consolas, monospace;"> （一堆属性的用法）</span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="color: #666666; font-family: Courier, Consolas, monospace;"><br /></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="color: #666666; font-family: Courier, Consolas, monospace;"> </span><span style="font-family: Courier, Consolas, monospace;"><span style="color: #010600;">转化坐标</span></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="font-family: Courier, Consolas, monospace;"><span style="color: #010600;"> 很多时候（特别是touch事件处理）,程序需要在不同的view frame rect之类的东西之类转换坐标。例如：touch事件向系统报告时使用window坐标系，view处理事件的时候往往要转换成view的本地坐标系统。</span></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="font-family: Courier, Consolas, monospace;"><span style="color: #010600;"> UIView中定义了以下方法做转化：</span></span></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="font-family: Courier, Consolas, monospace;"><span style="color: #010600;"> </span></span></span></div>
<ul style="list-style-type: none; list-style-position: outside; list-style-image: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2.5em; padding-top: 0px; padding-right: 0px; padding-bottom: 1em; padding-left: 0.5em;">
<li style="margin-top: 1px;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/convertPoint:fromView:" target="_self">convertPoint:fromView:</a></code></span></p>
</li>
<li style="margin-top: 1px;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/convertRect:fromView:" target="_self">convertRect:fromView:</a></code></span></p>
</li>
<li style="margin-top: 1px;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/convertPoint:toView:" target="_self">convertPoint:toView:</a></code></span></p>
</li>
<li style="margin-top: 1px;">
<div><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/convertRect:toView:" target="_self">convertRect:toView:</a></code></span></div>
</li>
</ul>
<div>
<div>在运行时调整view的大小和位置</div>
<div>一个view的大小变化时，它的subview应该跟着变。</div>
<div>UIView同时支持自动变和手动变。</div>
<div>自动变的情况，需要设定规则。</div>
<div>手动变时，设定具体的大小和位置。</div>
<div>当发生以下事件时，Layout会改变</div>
<div>view的bounds rectangle变化了。</div>
<div>手持设备方向变了</div>
<div>The set of Core Animation sublayers associated with the view’s layer changes and requires layout.</div>
<div>程序调用了view的 <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/setNeedsLayout" target="_self">setNeedsLayout</a></code> or <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/layoutIfNeeded" target="_self">layoutIfNeeded</a></code></div>
<div>程序调用了view&#8217;s underlying layer object的<a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instm/CALayer/setNeedsLayout" target="_self">setNeedsLayout</a></div>
<div>自动处理</div>
<div><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/autoresizesSubviews" target="_self">autoresizesSubviews</a> subview是否重排</code></div>
<div><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"> </code><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/autoresizingMask" target="_self">autoresizingMask</a></code> 控制subview如何重排,这个属性可以组合使用</div>
<div>参考 Table 3-2</div>
<div><img src="file:///Users/laihj/Library/Application%20Support/Evernote/data/51783/content/p293/ec08917eeafc48930b876ec40a726819.jpeg" alt="" width="469" height="266" /></div>
<div>手动</div>
<div>当一个view的大小改变时，view的layoutSubview被调用</div>
<div>于是你可以实现layoutSubview方法以实现手工修改布局</div>
<div>通过这一方法可以做到：</div>
<div>直接修改subviews的大小和布局。</div>
<div>增加或移除subviews或Core Animation layers.</div>
<div>使subvewi重绘。</div>
<div>常见的重排subviews的程序是那种有一个非常大的滚动区的程序</div>
<div>当一个程序有非常大的滚动区（N屏）的时候，直接载入一个这么大的view是不合适的，程序一般载入部分可见的view，当滚动动作发生时，即时重排。</div>
<div>写手动重排代码的时候要注意 :</div>
<div>1  设备方向改变</div>
<div>2 有电话呼入的时候，状态栏高度会变化。</div>
<div>两个参考</div>
<div><span style="margin-top: 0px; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; padding-bottom: 0.833em; vertical-align: top;"> 自动  <a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW5">“Handling Layout Changes Automatically Using Autoresizing Rules.”</a></span></div>
<div><span style="margin-top: 0px; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; padding-bottom: 0.833em; vertical-align: top;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW5"></a></span> 手动   see the <em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/samplecode/ScrollViewSuite/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008904" target="_self">ScrollViewSuite</a></em> sample.</div>
<div>运行时改动view</div>
<div>程序需要用户输入时，要调整界面响应这个输入（典型的如把当前输入框贴到软键盘上面）</div>
<div>典型的行为如下：</div>
<ul>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">view contro</span>ller
<ul>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">载入view，当view不再需要时，移除它。</span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">设备改变方向时，重排。过程中有可以移除一些</span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">界面状态改变时，如进行编辑模式</span></li>
</ul>
</li>
<li>Animation blocks
<ul>
<li>在animation block中进行两组view的转换</li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">实现一些特别效果时，也可能放在animation中操作</span></li>
</ul>
</li>
<li>General
<ul>
<li>touch 事件 <span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;">see<em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009541" target="_self">Event Handling Guide for iOS</a></em>.</span></span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">滚动 </span><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;">see <em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/UIScrollView_pg/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008179" target="_self">Scroll View Programming Guide for iOS</a></em>.</span></span></li>
<li><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">输入 </span><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;">see<em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009542" target="_self">Text, Web, and Editing Programming Guide for iOS</a></em>.</span></span> </li>
</ul>
</li>
</ul>
<div>与core animation layers交互</div>
<div>自定义view</div>
</div>
</div>
<div>自定义一个view的checklist</div>
<ul>
<li>初始化</li>
<li>dealloc 清理</li>
<li>drawRect:  绘</li>
<li>autoresizingMask  自动重排行为</li>
<li>如果包含subview
<ul>
<li>初始化时创建 subview</li>
<li>设置subview的  autoresizingMask</li>
<li>如果subview需要自定义layout 重写 layoutSubviews</li>
</ul>
</li>
<li>处理touch-based event
<ul>
<li>附加合适的gesture recognizer   <span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: 13px;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/addGestureRecognizer:" target="_self">addGestureRecognizer:</a></span></span></li>
<li><span style="font-family: STHeiti;">重写需要的touch方法（一定 要</span><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: 13px;"><a style="color: #3366cc; text-decoration: underline;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesCancelled:withEvent:" target="_self">touchesCancelled:withEvent:</a>）</span></span></li>
</ul>
</li>
<li><span style="color: #666666; font-family: Courier, Consolas, monospace;">如果要求view的打印版和屏幕上显示的不同，重写</span><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;"> <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/drawRect:forViewPrintFormatter:" target="_self">drawRect:forViewPrintFormatter:</a></code></span></span></li>
</ul>
<div><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><br /></span></div>
</div>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-windows/" title="[ios note] windows 2010.12.21">[ios note] windows</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/" title="[ios note] SQLite Tutorial 2010.12.30">[ios note] SQLite Tutorial</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2010/12/ios-note-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[ios note] windows</title>
		<link>http://www.laihj.net/2010/12/ios-note-windows/</link>
		<comments>http://www.laihj.net/2010/12/ios-note-windows/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 04:49:12 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650331</guid>
		<description><![CDATA[原文档位置

每个ios程序都至少需要一个window, UIWindow类的一个实例，有一些则可以需要更多。

Window有如下职责：
 包含可视的内容
 把用户操作分发给View和其它对象 这一过程中扮演重要角色
 帮助view controller处理位置变化

在iO中，window没有标题状态栏一类的东西，就是个空白的框
同样，程序要改变内容时，也不改变window，改变的是window包含的view中最前面的那几枚。

大部分的程序只用一个window，这个window占据全屏，从main nib file载入（或者纯手工代码实现）。

一般来说，其它的window都是由系统创建的，由特定的event触发，比如有电话接入。

windows相关任务

大部分程序一辈子只动一次window，就是在程序开始时创建一下。
如果需要，也可以用window实现来做一些事情：
重新转换坐标点和rectangle
see “Converting Coordinates in the View Hierarchy.”
用notifications来跟踪window相关的变化
see “Monitoring Window Changes.”


建立和配置windows

可以用IB，也可以手动
运行时创建，delegate obejct retain一个window
如果程序用了多于一个winows， 一般做法是用时才加载（另一个）
无论程序是前台还是后台，主window都在launch time(?)创建。
建立和配置的代价并不高。
但如果程序启动直接进后台，最好不要在它进入前台前做window.

用IB
一般不用自己动手，xcode自带一个MainWindow.xib
在application delegate object里面定义outlet，在程序中使用这个outlet操作window
注意
建议使window全屏，如果不这样做，可能有一些touch事件无法收到
这是因为，只有window范围内的touch事件能被识别。view按说是在window中，但iOS并不限制view显示在winows外。即：若不全屏，有可以出现以下情况：看到一个按钮，点击无反应，因为它不在window的rectangle的范围内。
用IB时也要：
 使用outlet关联到delegate或file owner，这样代码中才能访问。
 如果要用自已的xib替代MainWindow,需要在Info.plist中修改属性。

更多资源 see Interface Builder User Guide.
手动
在delegate的application:didFinishLaunchingWithOptions:中加入如下代码
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
这里假设delegate有一个用来retain window的属性（self.window)
建window确认全屏，不需要为statues bar之类的东西预留空间，这事儿在放view的时候做，view controller会自动处理。
往window里面添加view
每个window都有一个相应的root view obejct （由相应的view controller管理)
 使用单一的root view可以简化工作。
 [window addSubview:viewController.view];
用nib file来做这事更简单，只要设一个属性。
可以用任何view来做 root view。
配置一个root view时，你需要同时设定它在window中的大小和位置。
改变window Level
每个window都有可配置的 windowLevel 属性，决定其与其它window的关系，上还是下。
监视window改变
使用相关notifications


UIWindowDidBecomeVisibleNotification


UIWindowDidBecomeHiddenNotification


UIWindowDidBecomeKeyNotification


UIWindowDidResignKeyNotification


 
Related Posts[ios] [...]]]></description>
			<content:encoded><![CDATA[<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="font-size: large;"><strong><a href="http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingWindows/CreatingWindows.html">原文档位置</a></strong></span></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><span style="font-size: large;"><strong><br /></strong></span></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">每个ios程序都至少需要一个window, UIWindow类的一个实例，有一些则可以需要更多。</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><br /></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">Window有如下职责：</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"> 包含可视的内容</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"> 把用户操作分发给View和其它对象 这一过程中扮演重要角色</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"> 帮助view controller处理位置变化</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><br /></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">在iO中，window没有标题状态栏一类的东西，就是个空白的框</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">同样，程序要改变内容时，也不改变window，改变的是window包含的view中最前面的那几枚。</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><br /></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">大部分的程序只用一个window，这个window占据全屏，从main nib file载入（或者纯手工代码实现）。</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><br /></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;">一般来说，其它的window都是由系统创建的，由特定的event触发，比如有电话接入。</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><br /></span></div>
<h4 style="font-family: Arial;"><span style="font-size: small; font-family: 'Lucida Grande';"><strong><span style="color: #2655f5;">windows相关任务</span></strong></span></h4>
<h4 style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><strong><br /></strong></span></h4>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><strong>大部分程序一辈子只动一次window，就是在程序开始时创建一下。</strong></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><strong>如果需要，也可以用window实现来做一些事情：</strong></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: small;"><strong>重新转换坐标点和rectangle</strong></span></div>
<div style="font-family: Arial;">see <span style="margin-top: 0px; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; padding-bottom: 0.833em; vertical-align: top;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW40">“Converting Coordinates in the View Hierarchy.”</a></span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">用notifications来跟踪window相关的变化</span></div>
<div style="font-family: Arial;">see <span style="margin-top: 0px; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; padding-bottom: 0.833em; vertical-align: top;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingWindows/CreatingWindows.html#//apple_ref/doc/uid/TP40009503-CH4-SW13">“Monitoring Window Changes.”</a></span></div>
<div style="font-family: Arial;">
<div><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;"><br /></span></span></div>
<h4><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><strong><span style="color: #436ff6;">建立和配置windows</span></strong></span></h4>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><strong><br /></strong></span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">可以用IB，也可以手动</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">运行时创建，delegate obejct retain一个window</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">如果程序用了多于一个winows， 一般做法是用时才加载（另一个）</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">无论程序是前台还是后台，主window都在launch time(?)创建。</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">建立和配置的代价并不高。</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">但如果程序启动直接进后台，最好不要在它进入前台前做window.</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><br /></span></div>
<h5><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"><strong>用IB</strong></span></h5>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">一般不用自己动手，xcode自带一个MainWindow.xib</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">在application delegate object里面定义outlet，在程序中使用这个outlet操作window</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">注意</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">建议使window全屏，如果不这样做，可能有一些touch事件无法收到</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">这是因为，只有window范围内的touch事件能被识别。view按说是在window中，但iOS并不限制view显示在winows外。即：若不全屏，有可以出现以下情况：看到一个按钮，点击无反应，因为它不在window的rectangle的范围内。</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">用IB时也要：</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 使用outlet关联到delegate或file owner，这样代码中才能访问。</span></div>
<div><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;"> 如果要用自已的xib替代MainWindow,需要在Info.plist中修改属性。</span></div>
</div>
<p><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">更多资源 </span>see <em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/IB_UserGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005344" target="_self">Interface Builder User Guide</a></em>.</p>
<h5 style="font-family: Arial;">手动</h5>
<div style="font-family: Arial;">在delegate的<a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didFinishLaunchingWithOptions:" target="_self">application:didFinishLaunchingWithOptions:</a>中加入如下代码</div>
<div style="font-family: Arial;">self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];</div>
<div style="font-family: Arial;">这里假设delegate有一个用来retain window的属性（self.window)</div>
<div style="font-family: Arial;">建window确认全屏，不需要为statues bar之类的东西预留空间，这事儿在放view的时候做，view controller会自动处理。</div>
<h6 style="font-family: Arial;"><span style="font-family: STHeiti;">往window里面添加view</span></h6>
<div style="font-family: Arial;"><span style="font-family: STHeiti;">每个window都有一个相应的root view obejct （由相应的view controller管理)</span></div>
<div style="font-family: Arial;"><span style="font-family: STHeiti;"> 使用单一的root view可以简化工作。</span></div>
<div style="font-family: Arial;"><span style="font-family: STHeiti;"> </span>[window addSubview:viewController.view];</div>
<div style="font-family: Arial;">用nib file来做这事更简单，只要设一个属性。</div>
<div style="font-family: Arial;">可以用任何view来做 root view。</div>
<div style="font-family: Arial;">配置一个root view时，你需要同时设定它在window中的大小和位置。</div>
<div style="font-family: Arial;"><span style="font-family: STHeiti;">改变window Level</span></div>
<div style="font-family: Arial;"><span style="font-family: STHeiti;">每个window都有可配置的</span> <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/occ/instp/UIWindow/windowLevel" target="_self">windowLevel</a></code> 属性，决定其与其它window的关系，上还是下。</div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">监视window改变</span></div>
<div style="font-family: Arial;"><span style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif;">使用相关notifications</span></div>
<ul style="list-style-type: square; list-style-position: outside; list-style-image: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2.5em; padding-top: 0px; padding-right: 0px; padding-bottom: 1em; padding-left: 0.5em; font-family: Arial;">
<li style="margin-top: 0.583em;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIWindowDidBecomeVisibleNotification" target="_self">UIWindowDidBecomeVisibleNotification</a></code></span></p>
</li>
<li style="margin-top: 0.583em;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIWindowDidBecomeHiddenNotification" target="_self">UIWindowDidBecomeHiddenNotification</a></code></span></p>
</li>
<li style="margin-top: 0.583em;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIWindowDidBecomeKeyNotification" target="_self">UIWindowDidBecomeKeyNotification</a></code></span></p>
</li>
<li style="margin-top: 0.583em;">
<p style="margin-top: 0.667em; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; display: inline;"><span style="border-collapse: separate; color: #000000; font-family: STHeiti; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: #666666;"><a style="color: #3366cc; text-decoration: none;" href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIWindowDidResignKeyNotification" target="_self">UIWindowDidResignKeyNotification</a></code></span></p>
</li>
</ul>
<p> </p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/04/ios-sharekit-twitter-facebook/" title="[ios] shareKit,三行代码分享到社交媒体 2011.04.25">[ios] shareKit,三行代码分享到社交媒体</a>(1)</li>
<li><a href="http://www.laihj.net/2011/01/ios%e7%ae%80%e5%8d%95%e7%9a%84%e9%a5%bc%e5%9b%be%e4%bb%a3%e7%a0%81%e6%8e%a8%e8%8d%90/" title="[ios]简单的饼图代码推荐 2011.01.10">[ios]简单的饼图代码推荐</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/ios-note%e5%ae%9e%e7%8e%b0uitextview%e7%9a%84%e5%9c%86%e8%a7%92/" title="[ios note]实现UITextView的圆角 2011.01.6">[ios note]实现UITextView的圆角</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-sqlite-tutorial/" title="[ios note] SQLite Tutorial 2010.12.30">[ios note] SQLite Tutorial</a>(0)</li>
<li><a href="http://www.laihj.net/2010/12/ios-note-view/" title="[ios note] view 2010.12.22">[ios note] view</a>(0)</li>
<li><a href="http://www.laihj.net/2011/08/kal-iphone%e6%97%a5%e5%8e%86%e6%8e%a7%e4%bb%b6/" title="kal iphone日历控件 2011.08.18">kal iphone日历控件</a>(0)</li>
<li><a href="http://www.laihj.net/2011/07/ios-blocks-%e7%9b%b8%e5%85%b3%e5%ad%98%e6%a1%a3/" title="ios blocks 相关存档 2011.07.6">ios blocks 相关存档</a>(0)</li>
<li><a href="http://www.laihj.net/2011/01/iphone-%e9%a5%bc%e5%9b%be%e9%85%8d%e8%89%b2%e5%88%9d%e7%ba%a7/" title="[iphone] 饼图配色初级 2011.01.23">[iphone] 饼图配色初级</a>(0)</li>
</ul><h3>Recent Comments</h3><ul></ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2010/12/ios-note-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Android] anTimeLog，记录你的时间</title>
		<link>http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/</link>
		<comments>http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 14:04:37 +0000</pubDate>
		<dc:creator>laihj</dc:creator>
				<category><![CDATA[善其事]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[anTimeLog]]></category>

		<guid isPermaLink="false">http://www.laihj.net/?p=650292</guid>
		<description><![CDATA[
anTimeLog是一枚基于Google Android系统的时间日志软件。就像图标所显示的那样，anTimeLog的目标很简单：把从事一项活动的开始和结束时间记下来。让使用者可以正确地了解自己每天二十四小时时间的消耗情况，从而为个人的时间管理提供参考。
我写了简单的使用指南，欢迎有Android的朋友试用.
Related Posts程序员何苦为难程序员(1)
[Android]用shell卸载安装在模拟器上的应用(0)
Recent Commentsnob0dy : 严重期待type…很好的软件…
jeson : 非常好的软件，我会在我常去的论坛推广。
寻找记录时间开销的软件很久了，谢谢作者的辛勤劳动！！
laihj : Sorry.I sent an email to you.Thank you and sorry.
Igor : I like your application, but it should be improved...
laihj : 对不起各位，前几天机器硬盘崩了，这个项目的代码没有备份。而且最近公司的项目忙，anTimeLog可能...
]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-650277 alignleft" title="antimelog" src="http://www.laihj.net/wp-content/uploads/2010/06/antimelog1.png" alt="antimelog" width="64" height="64" /></p>
<p><span style="font-size: medium;">anTimeLog是一枚基于Google Android系统的时间日志软件。就像图标所显示的那样，anTimeLog的目标很简单：把从事一项活动的开始和结束时间记下来。让使用者可以正确地了解自己每天二十四小时时间的消耗情况，从而为个人的时间管理提供参考。</span></p>
<p>我写了<a href="http://www.laihj.net/antimeloginfo/">简单的使用指南</a>，欢迎有Android的朋友试用.</p>
<h3>Related Posts</h3><ul><li><a href="http://www.laihj.net/2011/01/%e7%a8%8b%e5%ba%8f%e5%91%98%e4%bd%95%e8%8b%a6%e4%b8%ba%e9%9a%be%e7%a8%8b%e5%ba%8f%e5%91%98/" title="程序员何苦为难程序员 2011.01.14">程序员何苦为难程序员</a>(1)</li>
<li><a href="http://www.laihj.net/2010/05/uninstall-by-shell/" title="[Android]用shell卸载安装在模拟器上的应用 2010.05.26">[Android]用shell卸载安装在模拟器上的应用</a>(0)</li>
</ul><h3>Recent Comments</h3><ul><li><a class="commentor" href="" >nob0dy</a> : <a class="comment_content" href="http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comment-1225" title="View the entire comment by nob0dy" >严重期待type…很好的软件…</a></li>
<li><a class="commentor" href="" >jeson</a> : <a class="comment_content" href="http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comment-1160" title="View the entire comment by jeson" >非常好的软件，我会在我常去的论坛推广。
寻找记录时间开销的软件很久了，谢谢作者的辛勤劳动！！</a></li>
<li><a class="commentor" href="" >laihj</a> : <a class="comment_content" href="http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comment-1130" title="View the entire comment by laihj" >Sorry.I sent an email to you.Thank you and sorry.</a></li>
<li><a class="commentor" href="" >Igor</a> : <a class="comment_content" href="http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comment-1129" title="View the entire comment by Igor" >I like your application, but it should be improved...</a></li>
<li><a class="commentor" href="" >laihj</a> : <a class="comment_content" href="http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/#comment-1127" title="View the entire comment by laihj" >对不起各位，前几天机器硬盘崩了，这个项目的代码没有备份。而且最近公司的项目忙，anTimeLog可能...</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.laihj.net/2010/06/android-antimelog%ef%bc%8c%e8%ae%b0%e5%bd%95%e4%bd%a0%e7%9a%84%e6%97%b6%e9%97%b4/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

