<?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; 06 &#8211; 视图控制器（ViewControllers）</title>
	<atom:link href="http://c.gzl.name/archives/category/iphone/viewcontroller/feed" rel="self" type="application/rss+xml" />
	<link>http://c.gzl.name</link>
	<description>IPhone, Cocoa, PHP, Javascript, JQuery, Actionscript, etc...</description>
	<lastBuildDate>Thu, 29 Dec 2011 07:20:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>不要对viewController作这样的事情</title>
		<link>http://c.gzl.name/archives/326</link>
		<comments>http://c.gzl.name/archives/326#comments</comments>
		<pubDate>Thu, 13 Aug 2009 02:41:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[05 - 视图（View）]]></category>
		<category><![CDATA[06 - 视图控制器（ViewControllers）]]></category>
		<category><![CDATA[iPhone开发]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://c.gzl.name/?p=326</guid>
		<description><![CDATA[错误： UIViewController *aViewController = &#91;&#91;UIViewController alloc&#93; init&#93;; &#160; &#91;window addSubview:aViewController.view&#93;; &#160; &#91;aViewController release&#93;; 这样的话，系统会崩溃的&#8230; window或着其他父视图是不会retain整个viewController的，这个时候不能立刻release 正确： &#91;aViewController.view removeFromSuperview&#93;; &#160; &#91;aViewController release&#93;; 也就是说，在release之前需要从superview中移除这个viewController的view。如果一直都需要这个view，那就在dealloc里面作这些事情就可以了]]></description>
		<wfw:commentRss>http://c.gzl.name/archives/326/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone上的JSON（三）JSON+UITableView</title>
		<link>http://c.gzl.name/archives/318</link>
		<comments>http://c.gzl.name/archives/318#comments</comments>
		<pubDate>Mon, 10 Aug 2009 22:12:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[06 - 视图控制器（ViewControllers）]]></category>
		<category><![CDATA[08 - 列表视图（TableViews）]]></category>
		<category><![CDATA[09 - 数据（Data）]]></category>
		<category><![CDATA[iPhone开发]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[UITableView]]></category>
		<category><![CDATA[UITableViewController]]></category>

		<guid isPermaLink="false">http://c.gzl.name/?p=318</guid>
		<description><![CDATA[既然JSON这么好，它怎么和UITableView结合使用呢？ 首先看看我们的JSON文件吧： { &#34;老张家&#34;:[&#34;大张&#34;,&#34;二张&#34;,&#34;三张&#34;], &#34;老李家&#34;:[&#34;大李&#34;,&#34;二李&#34;] } 完成的作品是这样样子的～～(点击放大阿～～) 好，开始打代码吧。 1，首先copy JSON库到当前的Project里面。 2，建立一个数据源类。我给它起名叫MyDataSource, 看看里面都有什么吧： @interface MyDataSource : NSObject &#123;&#125; + &#40;id&#41;dataSource; @end &#160; #import &#34;JSON.h&#34; &#160; @implementation MyDataSource + &#40;id&#41;dataSource &#123; NSString* JSONString = &#91;NSString stringWithContentsOfFile:&#91;&#91;NSBundle mainBundle&#93; pathForResource:@&#34;data&#34; ofType:@&#34;json&#34;&#93; encoding:NSUTF8StringEncoding error:nil&#93;; return &#91;JSONString JSONValue&#93;; &#125; @end 里面非常简单，只有一个类方法dataSource。在其中我们读取json文件的内容到一个NSString中，并用JSON框架来解读成一个NSDictionary，返回值为id。因为虽然大多的时候最外的对象都为NSDictionary，但是出于严谨，万一是NSArray不就崩溃了。所以使用id，这样其实就有再次可以用的特性了。 3，建立一个UITableViewController, 然后作适当的设置： #import &#34;MyTableViewController.h&#34; #import &#34;MyDataSource.h&#34; &#160; @implementation MyTableViewController &#160; [...]]]></description>
		<wfw:commentRss>http://c.gzl.name/archives/318/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TTPhotoViewController使用向导</title>
		<link>http://c.gzl.name/archives/250</link>
		<comments>http://c.gzl.name/archives/250#comments</comments>
		<pubDate>Mon, 03 Aug 2009 05:22:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[06 - 视图控制器（ViewControllers）]]></category>
		<category><![CDATA[iPhone开发]]></category>
		<category><![CDATA[Three20]]></category>
		<category><![CDATA[TTPhoto]]></category>
		<category><![CDATA[TTPhotoViewController]]></category>

		<guid isPermaLink="false">http://c.gzl.name/?p=250</guid>
		<description><![CDATA[Three20库是再好不过的iPhone开发资源了，尤其是其中提供的TT图片视图控制器提供了简单易用的图片浏览功能，下面我就简单的介绍了一下如何使用TTPhotoViewController /*********************************************************************************************/ 首先我们建立一个TTPhotoViewController的子类： @interface LibDetailViewController : TTPhotoViewController &#123; 然后在viewDidLoad代理方法中添加数据源（datasource） ... ... for &#40;NSInteger i=1; i&#38;lt;=libLength; i++&#41; &#123; picIndex = &#91;Zeros stringByAppendingString:&#91;NSString stringWithFormat:@&#34;%d&#34;,i&#93;&#93;; &#160; picIndex = &#91;picIndex substringFromIndex:&#40;&#91;picIndex length&#93; - libDigits&#41;&#93;; &#160; &#91;photosArray addObject:&#91;&#91;&#91;MockPhoto alloc&#93; initWithURL:&#91;NSString stringWithFormat:@&#34;%@%@/o/%@%@%@.jpg&#34;,addr,libName,libName,addiPage,picIndex&#93; smallURL:&#91;NSString stringWithFormat:@&#34;%@%@/%@%@%@.jpg&#34;,addr,libName,libName,addiPage,picIndex&#93; size:CGSizeMake&#40;320, 480&#41;&#93;autorelease&#93;&#93;; //这一行是最重要了，因为TTPhotoViewController需要的是一个TTPhotoSource作为数据源对象， //但是这个对象其实就是一个TTPhoto的数组，所以我们在这里创建并添加所有的图片信息到一个可变数组内。 &#125; &#160; self.photoSource = &#91;&#91;&#91;MockPhotoSource alloc&#93; initWithType:MockPhotoSourceDelayed title:libTitle photos:photosArray photos2:nil&#93; autorelease&#93;; //这里初始化并赋值这个TTPhotoSource对象到self.photoSource上 &#160; [...]]]></description>
		<wfw:commentRss>http://c.gzl.name/archives/250/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

