<?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>Matt&#039;s Portfolio</title>
	<atom:link href="http://mattvague.com/feed" rel="self" type="application/rss+xml" />
	<link>http://mattvague.com</link>
	<description>The Portfolio of Matt Vague, Vancouver Interactive Designer &#38; Developer</description>
	<lastBuildDate>Wed, 09 Dec 2009 22:07:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Three20 TTTableItem Tutorial</title>
		<link>http://mattvague.com/three20-tttableitem-tutorial</link>
		<comments>http://mattvague.com/three20-tttableitem-tutorial#comments</comments>
		<pubDate>Sun, 23 Aug 2009 00:50:24 +0000</pubDate>
		<dc:creator>MattV</dc:creator>
				<category><![CDATA[Three20]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=979</guid>
		<description><![CDATA[Say Hello to Three20 TTTableItemCells
Over the last couple of months I&#8217;ve shown you how to use Joe Hewitt&#8217;s Three20 iPhone library to create css-like stylesheets for your iPhone Apps, as well as custom table cells for your iPhone Apps.
But a while ago Joe changed up the way we make custom table cells. Instead of using TTTableField [...]]]></description>
			<content:encoded><![CDATA[<h2 style="text-align: left;">Say Hello to Three20 TTTableItemCells</h2>
<p>Over the last couple of months I&#8217;ve shown you how to use <a title="Joe Hewitt's blog" href="http://www.joehewitt.com/" target="_blank">Joe Hewitt&#8217;s</a> <a href="http://github.com/joehewitt/three20/tree/master">Three20 iPhone library </a>to create <a href="http://mattvague.com/three20-stylesheets-tutorial">css-like stylesheets</a> for your iPhone Apps, as well as <a href="http://mattvague.com/three20-custom-cells-iphone-tutorial">custom table cells</a> for your iPhone Apps.</p>
<p>But a while ago Joe changed up the way we make custom table cells. Instead of using <strong>TTTableField and TTTableFieldCell </strong>we now use <strong>TTTableItem and TTTableItemCell </strong>to accomplish custom table cells.</p>
<p>So today I am going to show you how to create an iPhone App using Three20&#8217;s TTTableItem and TTTableItemCell.</p>
<h2>Enough talk! Lets start the show</h2>
<p>This is the game plan for creating our custom table cells:</p>
<ol>
<li>First we&#8217;re going to decide on, and then design the custom cell we want for our App</li>
<li>Then we&#8217;re going to setup our App, create some necessary files, etc</li>
<li>And we&#8217;re going to make our own TableItems by subclassing TTTableItem</li>
<li>We&#8217;re going to make our own TableItemCells by subclassing TTTableItemCell</li>
<li>We&#8217;re going instantiate our new TableItems in our DataSource</li>
<li>We&#8217;re going to make the App render the correct TableItemCell for each TableItem we just made</li>
<li>And then finally when we&#8217;ve done all the other stuff ^, we&#8217;ll have a sexy new app with sexy custom table cells</li>
</ol>
<h3>1. Designing our Custom Cell</h3>
<p>Due to several questions and requests about putting images in custom cells, I think I&#8217;ll show you how to put some images, as well as text into our cell</p>
<p><strong>Our App will look something like this:</strong></p>
<p><img class="alignnone size-full wp-image-1173" title="Picture 3" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-3.png" alt="Picture 3" width="165" height="248" /></p>
<h3>2. Setup the App</h3>
<p>I think the easiest way to learn this shiznit, is to <strong>follow along step by step with this tutorial </strong>(i&#8217;ve created a three20 App template that works great for this)</p>
<ol>
<li>Download or Clone my <a href="http://github.com/mattvague/three20-iPhone-tutorials/tree/master">Three20 Tutorial repository</a> from github</li>
<li>When my repo is downloaded or cloned open it and copy and past the <strong>basic-navigation-app-template</strong> somewhere else on your computer (if you want)
<p>The three20-iPhone-tutorials folder should now look like this:</p>
<p><img class="alignnone size-full wp-image-1161" title="Picture 14" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-14.png" alt="Picture 14" width="335" height="113" /></p>
</li>
<li>Rename <strong>basic-navigation-app-template</strong> <strong>copy</strong> folder to something like <strong>tableitem-tutorial-working</strong></li>
<li>Open the <strong>Xcode Project file </strong>inside of your new folder (again we&#8217;re using a template App that I created)</li>
<li>Now we need to create some new classes inside of XCode:
<ol>
<li>We need a new class that will subclass TTTableItem. Go <strong>File</strong> &gt;&gt; <strong>New File</strong> &gt;&gt; <strong>Objective-C Class</strong> &gt;&gt; Name it <strong>BNTableItem</strong> (following Joe&#8217;s naming conventions). Make sure &#8220;Also create BNTableItem.h&#8221; is checked.</li>
<li>We also need a new class where we will sublclass TTTableItemCell. Go <strong>File </strong> &gt;&gt; <strong>New File</strong> &gt;&gt; <strong>Objective-C Class</strong> &gt;&gt; Name it <strong>BNTableItemCell</strong> (following Joe&#8217;s naming conventions). Make sure &#8220;Also create BNTableItemCell.h&#8221; is checked.</li>
</ol>
</li>
<li>Now that our all of our files are created let&#8217;s give our App a title. Go into <strong>RootViewController.m</strong> and change the line
<p><strong>self.title = @&#8221;Tutorial Title&#8221;;</strong></p>
<p>to</p>
<p><strong>self.title = @&#8221;TableItem Tutorial&#8221;;.</strong></p>
<p><strong>RootViewController.m</strong> should now look like this:</p>
<pre name="code" class="objc">#import "RootViewController.h"  

#pragma mark import dataSource
#import "RootViewDataSource.h"  

# pragma mark import table cells  

@implementation RootViewController  

///////////////////////////////////////////////////////////////////////////////////////////////////
// UIViewController  

- (void)loadView {
    [super loadView];  

    self.tableView = [[[UITableView alloc] initWithFrame:self.view.bounds
                                                   style:UITableViewStyleGrouped] autorelease];
    self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth
    | UIViewAutoresizingFlexibleHeight;
    self.variableHeightRows = YES;
    self.title = @"TableItem Tutorial";
    [self.view addSubview:self.tableView];
}  

//////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewController  

- (id)createDataSource {
    return [RootViewDataSource rootViewDataSource];
}  

@end  </pre>
</li>
<li><strong><span style="font-weight: normal;">Make sure that you have selected </span>Device 3.0<span style="font-weight: normal;"> or </span>Simulator 3.0<span style="font-weight: normal;"> to run the app</span></strong></li>
<li><strong>Open the App and see what happens.</strong> Click <strong>Build and Go</strong> (or <strong>Build</strong> &gt;&gt; <strong>Build and Go (Run)</strong>).
<p>The App should look like this (nothing special yet, but just you wait):</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-1.png"><img class="alignnone size-full wp-image-1209" title="Picture 1" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-1.png" alt="Picture 1" width="154" height="232" /></a></p>
</li>
</ol>
<h3>3. Subclass TTTableItem</h3>
<p>Now we need to make our TableItem. To do this we are going to subclass TTTableCaptionedItem.</p>
<p>TableItems<strong> hold the data</strong>, TableItemCells actually <strong>display the data</strong>.</p>
<p><strong>Sink that into your head, it&#8217;s important:</strong></p>
<p><strong>TableItems</strong> = Holds the data, <strong>TableItemCells</strong> = Displays the data held in it&#8217;s TableItem</p>
<p>Do the following steps, once they are done I will explain what was accomplished.</p>
<ol>
<li>Go into <strong>BNTableItem.h</strong> and DELETE EVERYTHING</li>
<li>Go into <strong>BNTableItem.m</strong> and DELETE EVERYTHING</li>
<li>We should now have NOTHING in either <strong>BNTableItem.h</strong> or <strong>BNTableItem.m</strong></li>
<li>Now we need to subclass TTTableCaptionedItem because it&#8217;s quite similar to what we are trying to accomplish, but needs some enhancements. <strong>Copy </strong><strong>and paste</strong> this code into the empty <strong>BNTableItem.h</strong> file:
<pre name="code" class="objc">#import "Three20/Three20.h"  

///////////////////////////////////////////////////////////////////////////////////////////////////  

////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelow  /////
////////////////////////////////////////////////////////

@interface BNTableCaptionedItemWithThreeImagesBelow : TTTableCaptionedItem { 

}  

@end  </pre>
</li>
<li>Now <strong>copy and paste</strong> this code into<strong> BNTableItem.m</strong>:
<pre name="code" class="objc">#import "BNTableItem.h"

///////////////////////////////////////////////////////////////////////////////////////////////////  

////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelow  /////
////////////////////////////////////////////////////////

@implementation BNTableCaptionedItemWithThreeImagesBelow

@end</pre>
</li>
</ol>
<p>We just created a subclass of  TTTableCaptionedItem which we named <strong>BNTableCaptionedItemWithThreeImagesBelow</strong>.</p>
<p>But we haven&#8217;t changed anything in our class yet, let&#8217;s do that now:</p>
<ol>
<li>Go back to <strong>BNTableItem.h</strong> and <strong>modify it</strong> so the file looks exactly like this:
<pre name="code" class="objc">#import "Three20/Three20.h"  

///////////////////////////////////////////////////////////////////////////////////////////////////  

////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelow  /////
////////////////////////////////////////////////////////

@interface BNTableCaptionedItemWithThreeImagesBelow : TTTableCaptionedItem {
	NSString* _image1;
	NSString* _image2;
	NSString* _image3;
	TTStyle* _imageStyle;
}

@property(nonatomic,copy) NSString* image1;
@property(nonatomic,copy) NSString* image2;
@property(nonatomic,copy) NSString* image3;
@property(nonatomic,retain) TTStyle* imageStyle;

+ (id)itemWithText:(NSString*)text caption:(NSString*)caption image1:(NSString*)image1 image2:(NSString*)image2 image3:(NSString*)image3;

@end  </pre>
</li>
<li>Go to back to <strong>BNTableItem.m </strong>and <strong>modify it</strong> so the file looks exactly like this:
<pre name="code" class="objc">#import "BNTableItem.h"

///////////////////////////////////////////////////////////////////////////////////////////////////  

////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelow  /////
////////////////////////////////////////////////////////

@implementation BNTableCaptionedItemWithThreeImagesBelow
@synthesize image1 = _image1, image2 = _image2, image3 = _image3, imageStyle = _imageStyle;

///////////////////////////////////////////////////////////////////////////////////////////////////
// class public

+ (id)itemWithText:(NSString*)text caption:(NSString*)caption image1:(NSString*)image1 image2:(NSString*)image2 image3:(NSString*)image3 {
		BNTableCaptionedItemWithThreeImagesBelow* item = [[[self alloc] init] autorelease];
		item.text = text;
		item.caption = caption;
		item.image1 = image1;
		item.image2 = image2;
		item.image3 = image3;
		return item;
	}

///////////////////////////////////////////////////////////////////////////////////////////////////
// NSObject

- (id)init {
	if (self = [super init]) {
		_image1 = nil;
		_image2 = nil;
		_image3 = nil;
		_imageStyle = nil;
	}
	return self;
}

- (void)dealloc {
	TT_RELEASE_MEMBER(_image1);
	TT_RELEASE_MEMBER(_image2);
	TT_RELEASE_MEMBER(_image3);
	TT_RELEASE_MEMBER(_imageStyle);
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// NSCoding

- (id)initWithCoder:(NSCoder*)decoder {
	if (self = [super initWithCoder:decoder]) {
		self.image1 = [decoder decodeObjectForKey:@"image1"];
		self.image2 = [decoder decodeObjectForKey:@"image2"];
		self.image3 = [decoder decodeObjectForKey:@"image3"];
	}
	return self;
}

- (void)encodeWithCoder:(NSCoder*)encoder {
	[super encodeWithCoder:encoder];
	if (self.image1) {
		[encoder encodeObject:self.image1 forKey:@"image1"];
	}
	if (self.image2) {
		[encoder encodeObject:self.image2 forKey:@"image2"];
	}
	if (self.image3) {
		[encoder encodeObject:self.image3 forKey:@"image3"];
	}
}

@end
</pre>
</li>
</ol>
<p><strong> Finished that?</strong><strong> </strong>Good. I am not going to explain everything that we did there, but I will give an overview.</p>
<ul>
<li>We added <strong>3 new properties to our clas</strong><strong>s </strong>(one for each image)</li>
<li>We made a method called<strong> </strong><strong>+ (id)itemWithText:(NSString*)text caption:(NSString*)caption image1:(NSString*)image1 image2:(NSString*)image2 image3:)</strong> which accepts the addresses for each of the 3 images as well as our text content</li>
<li>We added the 3 image properties to the<strong> init </strong>method<strong>, </strong>the<strong> initWithCoder </strong>method<strong>, </strong>and<strong> encodeWithCoder </strong>method<strong>.</strong></li>
</ul>
<p>The BNTableItem part of this tutorial is now finished.</p>
<p>The next part of our tutorial deals with displaying the data from our TableItem (the labels, images, etc), lets get started</p>
<h3>4. Subclass TTTableItemCell</h3>
<p>Subclassing TTTableCaptionedItemCell (itself a subclass of TTTableItemCell) will be similar to the subclassing we just did of TTTableCaptionedItem.</p>
<ol>
<li>Go into <strong>BNTableItemCell.h</strong> and DELETE EVERYTHING</li>
<li>Go into <strong>BNTableItemCell.m</strong> and DELETE EVERYTHING</li>
<li>We should now have NOTHING in either <strong>BNTableItemCell.h</strong> or <strong>BNTableItemCell.m</strong></li>
<li>Now subclass TTTableCaptionedItemCell. Go into and <strong>BNTableItemCell.h</strong> and make it look like this:
<pre name="code" class="objc">#import "Three20/Three20.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelowCell     //
////////////////////////////////////////////////////////////

@interface BNTableCaptionedItemWithThreeImagesBelowCell : TTTableCaptionedItemCell {
  TTImageView* _imageView1;
  TTImageView* _imageView2;
  TTImageView* _imageView3;
}

@end</pre>
</li>
<li>Then go into <strong>BNTableItemCell.m</strong> and make it look like this:
<pre name="code" class="objc">#import "BNTableItemCell.h"
#import "BNTableItem.h"
#import "BNDefaultStylesheet.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

static CGFloat kHPadding = 10;
static CGFloat kVPadding = 15;
static CGFloat kImageWidth = 80;
static CGFloat kImageHeight = 80;

///////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////
//////   BNTableCaptionedItemWithThreeImagesBelowCell     ////
//////////////////////////////////////////////////////////////

@implementation BNTableCaptionedItemWithThreeImagesBelowCell

+ (CGFloat)tableView:(UITableView*)tableView rowHeightForItem:(id)item {
	BNTableCaptionedItemWithThreeImagesBelow* captionedItem = item;

	CGFloat maxWidth = tableView.width - kHPadding*2;

	CGSize textSize = [captionedItem.text sizeWithFont:TTSTYLEVAR(myHeadingFont)
					   constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
					   lineBreakMode:UILineBreakModeWordWrap];
	CGSize subtextSize = [captionedItem.caption sizeWithFont:TTSTYLEVAR(mySubtextFont)
						  constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];

	return kVPadding*2 + textSize.height + subtextSize.height + kImageHeight + kVPadding;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
	if (self = [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]) {
		_item = nil;

		_imageView1 = [[TTImageView alloc] initWithFrame:CGRectZero];
		[self.contentView addSubview:_imageView1];

		_imageView2 = [[TTImageView alloc] initWithFrame:CGRectZero];
		[self.contentView addSubview:_imageView2];

		_imageView3 = [[TTImageView alloc] initWithFrame:CGRectZero];
		[self.contentView addSubview:_imageView3];

	}
	return self;
}

- (void)dealloc {
	TT_RELEASE_MEMBER(_imageView1);
	TT_RELEASE_MEMBER(_imageView2);
	TT_RELEASE_MEMBER(_imageView3);
	[super dealloc];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// UIView

- (void)layoutSubviews {
	[super layoutSubviews];

	[self.detailTextLabel sizeToFit];
	self.detailTextLabel.top = kVPadding;

	self.textLabel.height = self.detailTextLabel.height;

	_imageView1.frame = CGRectMake(20, self.detailTextLabel.bottom + kVPadding, kImageWidth, kImageHeight);
	_imageView2.frame = CGRectMake(_imageView1.right + kHPadding, self.detailTextLabel.bottom + kVPadding, kImageWidth, kImageHeight);
	_imageView3.frame = CGRectMake(_imageView2.right + kHPadding, self.detailTextLabel.bottom + kVPadding, kImageWidth, kImageHeight);

}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewCell

- (id)object {
	return _item;
}

- (void)setObject:(id)object {
	if (_item != object) {
		[super setObject:object];

		BNTableCaptionedItemWithThreeImagesBelow* item = object;

		self.textLabel.textColor = TTSTYLEVAR(myHeadingColor);
		self.textLabel.font = TTSTYLEVAR(myHeadingFont);
		self.textLabel.textAlignment = UITextAlignmentRight;
		self.textLabel.contentMode = UIViewContentModeCenter;
		self.textLabel.lineBreakMode = UILineBreakModeWordWrap;
		self.textLabel.numberOfLines = 0;

		self.detailTextLabel.textColor = TTSTYLEVAR(mySubtextColor);
		self.detailTextLabel.font = TTSTYLEVAR(mySubtextFont);
		self.detailTextLabel.textAlignment = UITextAlignmentLeft;
		self.detailTextLabel.contentMode = UIViewContentModeTop;
		self.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;

		_imageView1.URL = item.image1;
		_imageView1.style = item.imageStyle;

		_imageView2.URL = item.image2;
		_imageView2.style = item.imageStyle;

		_imageView3.URL = item.image3;
		_imageView3.style = item.imageStyle;

    }
}

@end
</pre>
</li>
</ol>
<p>Woooo we&#8217;re on a roll, we just subclassed TTTableCaptionedItemCell, then modified it so that it has 3 image views underneath the heading and caption.</p>
<ul>
<li>In the <strong>rowHeightForItem</strong> method we made our cell adjust it&#8217;s size to the text content AND our new images.</li>
<li>In the <strong>initWithStyle</strong> method we allocated 3 TTImageViews (to hold our images) and added the TTImageViews as subviews of our main view.</li>
<li>in the <strong>layoutSubviews </strong>method we  made the textLabel (the heading label) and the detailTextLabel (the subtext label) fit together nicely, as well as sizing all three images and making them fit nice and centered underneath the text.</li>
<li>Finally in the <strong>setObject </strong>method<strong> </strong>we set the textColor, the font, and a few other important properties of our textLabel, and detailTextLabel, and we gave each of our 3 TTImageViews the URL of the image their supposed to display (the URL of each TTImageView should match the corresponding URL given for each address we are fed to our TTTableItem).</li>
</ul>
<p>Now we need to put our feed our TableItems to our TableView datasource</p>
<h3>5. Add Our TableItems to the DataSource</h3>
<p>Now what we&#8217;re going to do is instantiate and feed BNTableCaptionedItemWithThreeImagesBelow into our DataSource a few times while feeding it some text content and image addresses.</p>
<ol>
<li>
<p>To instantiate and feed our Tableitem into our datasource (twice), make <strong>RootViewDataSource.m</strong> look exactly like this:</p>
<pre name="code" class="objc">#import "RootViewDataSource.h"
#import "BNTableItem.h"
#import "BNTableItemCell.h"

@implementation RootViewDataSource

///////////////////////////////////////////////////////////////////////////////////////////////////
// public

+ (RootViewDataSource*)rootViewDataSource {
	RootViewDataSource* dataSource =  [[[RootViewDataSource alloc] initWithItems:
										[NSMutableArray arrayWithObjects: [BNTableCaptionedItemWithThreeImagesBelow itemWithText:@"These are some pictures of me (Matt) doing different stuff"
																									caption:@"Matt"
																									image1:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/boating.jpg"
																									image2:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/cooking.jpg"
																									image3:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/surfing.jpg"],
																		 [BNTableCaptionedItemWithThreeImagesBelow itemWithText:@"These are some pictures of Vancouver, BC"
																									caption:@"VanCity"
																									image1:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Vancouver_Aerial.jpg"
																									image2:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Coast-Mountains-BC.jpg"
																									image3:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Vancouver_Aerial_2.jpg"],
																		 nil]] autorelease];
	return dataSource;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)dealloc {
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource

- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 

	if ([object isKindOfClass:[BNTableCaptionedItemWithThreeImagesBelow class]]) {
		return [BNTableCaptionedItemWithThreeImagesBelowCell class];
	} else {
		return [super tableView:tableView cellClassForObject:object];
	}
}

- (void)tableView:(UITableView*)tableView prepareCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath {
	cell.accessoryType = UITableViewCellAccessoryNone;
}

@end</pre>
</li>
<li>
<p>Now try<strong> launching the App </strong>again<strong>. </strong></p>
</li>
</ol>
<p><strong>Looks kinda weird doesn&#8217;t it? </strong>That&#8217;s because we need to do one last thing which is to tell our App which kind of TableItemCell to render for our TableItems.</p>
<p><strong>Right now</strong> the App is just rendering the closest matching TableItemCell it could find, but not the one that we want (which is the one we just created).</p>
<h3>6. Render the correct TableItemCell for our TableItems</h3>
<p>This part is very simple, and I probably could have combined it with the last step, but it is something that is quite vital and I think deserves its own step.</p>
<ol>
<li><strong>Add the following code</strong> to <strong>RootViewDataSource.m</strong>, underneath the rootViewDataSource, and dealloc methods:
<pre name="code" class="objc">///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource

- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 

	if ([object isKindOfClass:[BNTableCaptionedItemWithThreeImagesBelow class]]) {
		return [BNTableCaptionedItemWithThreeImagesBelowCell class];
	} else {
		return [super tableView:tableView cellClassForObject:object];
	}
}</pre>
</li>
<li>Now <strong>RootViewDataSource.m</strong> should look exactly like this:
<pre name="code" class="objc">#import "RootViewDataSource.h"
#import "BNTableItem.h"
#import "BNTableItemCell.h"

@implementation RootViewDataSource

///////////////////////////////////////////////////////////////////////////////////////////////////
// public

+ (RootViewDataSource*)rootViewDataSource {
	RootViewDataSource* dataSource =  [[[RootViewDataSource alloc] initWithItems:
										[NSMutableArray arrayWithObjects: [[BNTableCaptionedItemWithThreeImagesBelow itemWithText:@"These are some pictures of me (Matt) doing different stuff"
																									caption:@"Matt"
																									image1:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/boating.jpg"
																									image2:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/cooking.jpg"
																									image3:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/surfing.jpg"] autorelease],
																		 [[BNTableCaptionedItemWithThreeImagesBelow itemWithText:@"These are some pictures of Vancouver, BC"
																									caption:@"VanCity"
																									image1:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Vancouver_Aerial.jpg"
																									image2:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Coast-Mountains-BC.jpg"
																									image3:@"http://mattvague.com/wordpress/wp-content/uploads/2009/08/Vancouver_Aerial_2.jpg"] autorelease]
																			,nil]] autorelease];
	return dataSource;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)dealloc {
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource

- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 

	if ([object isKindOfClass:[BNTableCaptionedItemWithThreeImagesBelow class]]) {
		return [BNTableCaptionedItemWithThreeImagesBelowCell class];
	} else {
		return [super tableView:tableView cellClassForObject:object];
	}
}

- (void)tableView:(UITableView*)tableView prepareCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath {
	cell.accessoryType = UITableViewCellAccessoryNone;
}

@end
</pre>
</li>
</ol>
<p><strong>Done yet? </strong>Hope so, cause that&#8217;s the last step!</p>
<h3>7. Run the App</h3>
<p><strong>Run our App by clicking on &#8220;Build and Go&#8221; </strong></p>
<p>It should look like this:</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-4.png"><img class="alignnone size-full wp-image-1183" title="Picture 4" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-4.png" alt="Picture 4" width="193" height="288" /></a></p>
<h2>Wrap Up / Download the working version</h2>
<p>If you are still having trouble or just want to checkout the source code, the final working version of my tutorial is<strong> <a href="http://github.com/mattvague/three20-iPhone-tutorials">availbile on github</a> </strong>as part of my <a title="Matt's three20 Tutorial repo" href="http://github.com/mattvague/three20-iPhone-tutorials" target="_blank">three20 tutorial repository</a>. <strong>Download </strong>or <strong>clone </strong>my repo and then open the <strong>tableitem-tutorial</strong> folder and open its Xcode Project.</p>
<p>If you have any questions please ask.<strong> </strong>The best way is to leave a comment below.</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/three20-tttableitem-tutorial/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>AppleTV Sucks, but doesn&#8217;t have to</title>
		<link>http://mattvague.com/appletv-sucks-but-doesnt-have-to</link>
		<comments>http://mattvague.com/appletv-sucks-but-doesnt-have-to#comments</comments>
		<pubDate>Fri, 21 Aug 2009 07:50:18 +0000</pubDate>
		<dc:creator>MattV</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Society]]></category>
		<category><![CDATA[Thinkers]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=1119</guid>
		<description><![CDATA[The reason AppleTV SUCKS is cause it doesn't provide instant gratification. THAT is because it lacks live broadcast TV.

But I think Apple may now have gotten their heads out of their asses in this respect.]]></description>
			<content:encoded><![CDATA[<h3><strong>Dear Steve:</strong></h3>
<p><strong> </strong>People still like instant gratification, that&#8217;s why Apple TV sucks.</p>
<h3><strong><br />
 </strong></h3>
<p><img class="alignnone size-full wp-image-1120" title="Picture 8" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-8.png" alt="Picture 8" width="274" height="133" /></p>
<h3>AppleTV SUCKS because it lacks live broadcast TV.</h3>
<p>Broadcast TV provides instant gratification. We turn it on, and <strong>get</strong> <strong>entertained NOW</strong><strong> <span style="font-weight: normal;"> <img src='http://mattvague.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span></strong></p>
<p>iTunes (as-is) doesn&#8217;t always provide instant gratification. <strong>L</strong><strong>ooking</strong> for a show, <strong>deciding</strong> whether to pay for it, then <strong>waiting</strong> for it download takes tiiime. We turn it on, and <strong>get entertained THEN </strong>(<span style="font-weight: normal;">as in the future) <strong> </strong> <img src='http://mattvague.com/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </span></p>
<p>It&#8217;s simple. When we want to zone out, when we wanna flick on the boob-tube and stop thinking we watch TV because it&#8217;s <strong>dumb</strong> and <strong>instant</strong>. We (the people) are happy when we&#8217;re <strong>dumb</strong> and <strong>gratified</strong>.</p>
<p><strong><span style="font-weight: normal;"><img class="alignnone size-full wp-image-1132" title="Picture 9" src="http://mattvague.com/wordpress/wp-content/uploads/2009/08/Picture-9.png" alt="Picture 9" width="252" height="176" /></span></strong></p>
<p>If Apple thought that people would switch totally to downloading TV shows and movies all the time from iTunes instead of watching Cable or Satellite TV <strong>they  underestimated how lazy we are. </strong>But I think Apple may now have <strong>gotten their heads out of their asses </strong>in this respect.</p>
<p>I believe Apple now realizes that they could probably<strong> </strong>put a <strong>kick ass new spin</strong> on current broadcast TV. Providing the ability to <strong>watch and record live TV</strong>, watch your already downloaded TV shows and movies, AND download and rent even more from one single system just makes sense.</p>
<p>If these rumours are true, than AppleTV gets the<strong> Matt  Stamp of Approval</strong>. YEEEEEE HAW. <a href="http://www.macrumors.com/2009/08/20/apple-tv-set-by-2011/">http://www.macrumors.com/2009/08/20/apple-tv-set-by-2011/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/appletv-sucks-but-doesnt-have-to/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The great divide: marketers &amp; designers</title>
		<link>http://mattvague.com/the-great-divide-marketers-designers</link>
		<comments>http://mattvague.com/the-great-divide-marketers-designers#comments</comments>
		<pubDate>Sun, 19 Jul 2009 00:49:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Society]]></category>
		<category><![CDATA[Thinkers]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=1081</guid>
		<description><![CDATA[In the words of my old boss "marketers and designers speak a different language"

This never really made sense to me until I took on a recent contract.]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1097" title="Alec Baldwin (a bulldog salesman/marketer) in the movie Glen Gary Glen Ross" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/alec-baldwin-glengarry-glen-ross.jpg" alt="Alec Baldwin (a bulldog salesman/marketer) in the movie Glen Gary Glen Ross" width="320" height="214" /></p>
<p>In the words of my old boss <strong>&#8220;marketers and designers speak a different language&#8221;</strong></p>
<p>This never really made sense to me until I took on a recent contract.</p>
<p>I developed a site for a company and when the site was reviewed by the marketing people every single comment made was that <strong>THEIR logo was to small</strong>, that <strong>THEIR brand should be promoted more</strong>, that<strong> the point of the site was to increase THEIR brand awareness</strong>.</p>
<p>On the other hand, when designers reviewed the site I heard things like <strong>&#8220;that font is unreadable&#8221;</strong>, <strong>&#8220;that wording might confuse PEOPLE&#8221;</strong>, and <strong>&#8220;PEOPLE wont notice that button&#8221;</strong>.</p>
<p><strong>My point is:</strong> We all want to make money and get our names out there. The difference being that a marketer&#8217;s strategy is to sell their product because everyone has heard of their product (whether it&#8217;s good or bad), while a designer&#8217;s strategy is to sell their product because the product is actually appealing, and is actually useful, which should lead all the happy customers to tell their friends about your product so that you don&#8217;t have to.</p>
<p>A Marketer&#8217;s bottom line is:<strong> CONVINCE THEM.</strong></p>
<p>A Designer&#8217;s bottom line is <strong>MAKE IT APPEALING, MAKE IT USEFUL</strong>.</p>
<p>Obviously myself being a designer, I am in favor of that latter approach to making the ching-ching, the $$$, the scrilla, the moolah.</p>
<p>Luckily I think we&#8217;re already in a paradigm shift towards more people adopting the latter way of thinking. This will lead to better products, that people are ACTUALLY HAPPY WITH.</p>
<p>Woot. Enough said.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/the-great-divide-marketers-designers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Summer Sessions with Sarah McLachlan, Neil Young, and Sheryl Crow in West Vancouver</title>
		<link>http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver</link>
		<comments>http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver#comments</comments>
		<pubDate>Wed, 15 Jul 2009 17:37:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=1050</guid>
		<description><![CDATA[
UPDATE: Tickets are sold out for Summer Sessions 2009  but I will make sure to write a new post if any more tickets become available, check back for updates!
I think the names say it all, this is going to be one WICKED conert. Sarah McLachlan, Neil Young, and Sheryl Crow are coming to rock out [...]]]></description>
			<content:encoded><![CDATA[
<a href='http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver/sheryl-crow' title='Sheryl Crow'><img width="152" height="188" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/Sheryl-Crow.jpg" class="attachment-thumbnail" alt="" title="Sheryl Crow" /></a>
<a href='http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver/sarahmclachlanjlc2005' title='sarahmclachlanjlc2005'><img width="152" height="188" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/sarahmclachlanjlc2005.jpg" class="attachment-thumbnail" alt="" title="sarahmclachlanjlc2005" /></a>
<a href='http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver/neilyoung' title='neilyoung'><img width="200" height="188" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/neilyoung.jpg" class="attachment-thumbnail" alt="" title="neilyoung" /></a>

<p><strong>UPDATE: Tickets are sold out for Summer Sessions 2009  but I will make sure to write a new post if any more tickets become available, check back for updates!</strong></p>
<p>I think the names say it all, this is going to be one WICKED conert. <strong>Sarah McLachlan, Neil Young, and Sheryl Crow </strong>are coming to rock out <strong>Summer Sessions </strong>at <strong>West Vancouver&#8217;s Ambleside Park </strong>on September 12th 2009.</p>
<p>If you&#8217;re interested in learning about the concert check out <a href="http://www.summersessions.ca" target="_blank">summersessions.ca</a> for more information.</p>
<p><a href="http://www.summersessions.ca" target="_blank"></a>Anyways hope I see ya&#8217;ll at the concert, keep on rockin&#8217;!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/summer-sessions-with-sarah-mclachlan-neil-young-and-sheryl-crow-in-west-vancouver/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Stop putting up with Data Abuse!</title>
		<link>http://mattvague.com/stop-putting-up-with-data-abuse</link>
		<comments>http://mattvague.com/stop-putting-up-with-data-abuse#comments</comments>
		<pubDate>Fri, 10 Jul 2009 00:17:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Society]]></category>
		<category><![CDATA[Thinkers]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=1023</guid>
		<description><![CDATA[&#8220;iPhone Carriers charge outrageous amounts for iPhone data plans, then tell us how we can and can&#8217;t use the data we paid for. We call this Data Abuse. Stop putting up with the it and take action on dataabuse.com!&#8221;
My friend / associate Erico and I finally got fed up with the way we (and everyone else) are [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;iPhone Carriers charge outrageous amounts for iPhone data plans, then tell us how we can and can&#8217;t use the data we paid for. We call this Data Abuse. Stop putting up with the it and take action on <a title="Data Abuse Website" href="http://www.dataabuse.com" target="_blank">dataabuse.com</a>!&#8221;</p>
<p>My friend / associate <a title="Erico's Site" href="histerico.net" target="_blank">Erico</a> and I finally got fed up with the way we (and everyone else) are treated by iPhone carriers and we decided to do something about it. We built a site dealing with &#8220;Data Abuse&#8221; which explains what Data Abuse is, some real life examples of it, and what people can do about it.</p>
<p><a href="http://www.dataabuse.com"><img class="alignnone size-medium wp-image-1024" title="Data Abuse site screenshot" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/Picture-1-400x359.png" alt="Data Abuse site screenshot" width="400" height="359" /></a></p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/stop-putting-up-with-data-abuse/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sarah Palin: Social Media Wanker</title>
		<link>http://mattvague.com/sarah-palin-social-media-wanker</link>
		<comments>http://mattvague.com/sarah-palin-social-media-wanker#comments</comments>
		<pubDate>Sun, 05 Jul 2009 02:35:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Society]]></category>
		<category><![CDATA[Thinkers]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=1002</guid>
		<description><![CDATA[Sarah Palin is now using social media EXCLUSIVLY to reach her followers. She's cutting the mainstream media out. - http://mashable.com/2009/07/04/sarah-palin-facebook/

I can come to only one conclusion:

Sarah Palin is a Social Media Wanker.]]></description>
			<content:encoded><![CDATA[<p><span><img class="size-medium wp-image-1006 alignleft" title="palin_turkey" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/palin_turkey-400x283.jpg" alt="palin_turkey" width="280" height="190" />Sarah <span>Palin</span> is now using social media EXCLUSIVLY to reach her followers. She&#8217;s cutting the mainstream media out. &#8211; <a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">http://mashable.com/2009/07/04/</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">sarah</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">-</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">palin</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">-</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">facebook</a><a href="http://mashable.com/2009/07/04/sarah-palin-facebook/" target="_blank">/</a></span></p>
<p>I can come to only one conclusion:</p>
<p><strong>Sarah Palin is a Social Media Wanker.</strong></p>
<p><span><strong>She thinks we&#8217;re gonna take it easy on her.</strong> She thinks that we&#8217;re <strong>not going to be on her ass</strong> every time she makes a mockery of herself and the United States political system with her idiocy, ignorance, and hypocrisy.</span></p>
<p>Folks, we&#8217;ve been given the opportunity to deliver the knockout blow to Sarah Palin: the politician, that time and again has shown that can&#8217;t speak for herself <strong>let alone speak for the most powerful country on earth</strong><strong>. </strong>Let&#8217;s use the Social Media to bring her out into the open and show her a real town hall meeting where real questions are asked, with real followup questions.</p>
<p><span>And maybe I am just crazy, but I also question the political wisdom of cutting out the regular media outlets (<span>Palin</span> being who she is).</span></p>
<p><span>This is of course <span>pure</span> opinion, but I&#8217;m preeetty sure that </span><strong><span><span style="font-weight: normal;">the vast majority of people who would consider voting for Sarah </span><span><span style="font-weight: normal;">Palin&#8217;s</span> don&#8217;t use</span> Facebook let alone Twitter.</span><span style="font-weight: normal; "> </span></strong></p>
<p><strong><span style="font-weight: normal; ">Nope if I were her I&#8217;d stick with the Fox News world where apparently &#8220;<a title="Sarah Palin Outsmarts the Left" href="http://www.foxnews.com/opinion/2009/07/04/sarah-palin-outsmarts-left/" target="_blank">Sarah Palin Outsmarts the Left</a>&#8220;.</span></strong></p>
<p><strong>I for one can&#8217;t wait to see how this all plays out.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/sarah-palin-social-media-wanker/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An iPhone App for making iPhone Apps</title>
		<link>http://mattvague.com/an-iphone-app-for-making-iphone-apps</link>
		<comments>http://mattvague.com/an-iphone-app-for-making-iphone-apps#comments</comments>
		<pubDate>Sun, 05 Jul 2009 00:11:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Three20]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=973</guid>
		<description><![CDATA[Cool! This hombre named klazuka built an iPhone App for creating an iPhone App. Now THIS GUY is forward thinking.

TTStyleBuilder lets you interactively create styles for your Three20 based iPhone Apps.
]]></description>
			<content:encoded><![CDATA[<p>Cool! This hombre named <a title="Klazuka's GitHub account" href="http://github.com/klazuka">klazuka</a> built an iPhone App for creating an iPhone App. Now <strong>THIS GUY is forward thinking.</strong></p>
<p>Basically klazuka&#8217;s <a title="TTStylebuilder GitHub repositiory" href="http://github.com/klazuka/TTStyleBuilder/tree/master" target="_blank">TTStyleBuilder</a> lets you interactively create styles for your <a title="Three20 iPhone library GitHub Repository" href="http://github.com/joehewitt/three20/tree/master" target="_blank">Three20</a> based iPhone Apps.</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/07/TTStylebuilder.jpg"><img class="alignnone size-full wp-image-974" title="TTStylebuilder Interface" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/TTStylebuilder.jpg" alt="TTStylebuilder Interface" width="132" height="200" /></a><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/07/TTStylebuilder-red-button-style.jpg"><img class="alignnone size-full wp-image-976" title="TTStylebuilder red button style" src="http://mattvague.com/wordpress/wp-content/uploads/2009/07/TTStylebuilder-red-button-style.jpg" alt="TTStylebuilder-red-button-style" width="132" height="200" /></a></p>
<p>Haven&#8217;t had time to play around with it yet, due to writing tutorials on this very subject (Three20), but I hope to be able to check it out ASAP.</p>
<p>Check back soon to hear about my experience with it and maaaaybe even a short tutorial (if needs be).</p>
<p><strong>Anyways here&#8217;s a video that shows TTStylebuilder in action:</strong></p>
<p>
<object width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=5429347&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=5429347&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object>
</p>
<p><a href="http://vimeo.com/5429347">TTStyleBuilder</a> from <a href="http://vimeo.com/klazuka">Keith Lazuka</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/an-iphone-app-for-making-iphone-apps/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Favorite Feeds: Week of June 26th</title>
		<link>http://mattvague.com/favorite-feeds-week-of-june-26th</link>
		<comments>http://mattvague.com/favorite-feeds-week-of-june-26th#comments</comments>
		<pubDate>Wed, 01 Jul 2009 07:51:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Feeds & Blogs]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=884</guid>
		<description><![CDATA[Some favorites for the week of  June 26st:
(no particular order)

The Young Turks: The Young Turks YouTube Channel
Dwight (from the TV Show The Office): Dwight&#8217;s Blog
The Huffington Post: Most Popular Entries
ReadWriteWeb: ReadWriteWeb Feed
ScrnShots.com: Recent Screenshots

]]></description>
			<content:encoded><![CDATA[<p>Some favorites for the week of  June 26st:</p>
<p>(no particular order)</p>
<ul>
<li>The Young Turks: <a title="The Young Turks on YouTube" href="http://www.youtube.com/ut_rss?type=username&amp;arg=TheYoungTurks" target="_blank">The Young Turks YouTube Channel</a></li>
<li>Dwight (from the TV Show The Office): <a href="http://www.nbc.com/The_Office/dwights-blog/rss/atom.xml" target="_blank">Dwight&#8217;s Blog</a></li>
<li>The Huffington Post: <a href="http://feeds.huffingtonpost.com/HP/MostPopular" target="_blank">Most Popular Entries</a></li>
<li>ReadWriteWeb: <a title="ReadWriteWeb" href="http://feeds2.feedburner.com/readwriteweb" target="_blank">ReadWriteWeb Feed</a></li>
<li>ScrnShots.com: <a href="http://www.scrnshots.com/screenshots.rss" target="_blank">Recent Screenshots</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/favorite-feeds-week-of-june-26th/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three20 Custom Cells iPhone Tutorial</title>
		<link>http://mattvague.com/three20-custom-cells-iphone-tutorial</link>
		<comments>http://mattvague.com/three20-custom-cells-iphone-tutorial#comments</comments>
		<pubDate>Thu, 25 Jun 2009 05:26:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Three20]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=577</guid>
		<description><![CDATA[In my last tutorial I showed you how to use CSS-like stylesheets in your iPhone Apps. Although I did make a custom cell I didn't really show how this is done, and I've decided to go into a bit more detail.

In this tutorial I am going to show you how to make custom table cells in your iPhone Apps using Joe Hewitt's Three20 library.]]></description>
			<content:encoded><![CDATA[<p><strong>*Note* This tutorial is now deprecated, </strong>please refer to my new <a href="http://mattvague.com/three20-tttableitem-tutorial">TableItem tutorial</a> for future learnin&#8217;s</p>
<h2>Introduction to custom three20 cells</h2>
<p>In my <a href="http://mattvague.com/three20-stylesheets-tutorial" target="_blank">last tutorial</a> I showed you how to use CSS-like stylesheets in your iPhone Apps. Although I did make a custom cell I didn&#8217;t really show how this is done, and I&#8217;ve decided to go into a bit more detail.</p>
<p>In this tutorial I am going to show you how to make custom table cells in your iPhone Apps using Joe Hewitt&#8217;s <a title="Three20 iPhone library on GitHub" href="http://github.com/joehewitt/three20/tree/master" target="_blank">Three20 library</a>.</p>
<p>Custom cells are very useful, they let you do things like this:</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-11.png"><img class="alignnone size-full wp-image-600" title="Some Custom Cells (From the three20 catalogue App)" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-11.png" alt="Custom Cells" width="132" height="200" /></a></p>
<p>But it&#8217;s worth mentioning that i&#8217;m not going show you how to make a complete iPhone App, nor install the Three20 library in your Apps (there is already a guide on how to do this on the <a href="http://github.com/joehewitt/three20/tree/master" target="_blank">three20 github page</a>).</p>
<p>I am going to assume that you either cloned my <a href="http://github.com/mattvague/three20-iPhone-tutorials/tree/master">three20 tutorial repository</a> from github and are following along in my <a href="http://mattvague.com/three20-stylesheets-tutorial" target="_blank">Three20 stylesheets tutorial</a>, or that you already have an app using three20 with a working tableview and datasource similar to mine (there are several ways to do this, but I am going to assume you&#8217;re using my way).</p>
<p>By the way, all my Three20 tutorials are available <a href="http://github.com/mattvague/three20-iPhone-tutorials/tree/master" target="_blank">on gitHub</a>.</p>
<p><strong>So lets get started:</strong></p>
<p>First things first, There are cells, and there are fields.</p>
<ul>
<li><strong>Cells</strong> control the labels, images, interface elements, etc that are actually displayed when a table cell is rendered.</li>
<li><strong>Fields</strong> control the actual data that is fed into each label, image, interface element, etc when the table cell is rendered.</li>
</ul>
<p>But although they usually go together, you don&#8217;t always HAVE to make a new field type for every new cell type. As long as all the data that the new cell needs is provided by an existing field, you need not make another.</p>
<p>For cells like the one below with a title and subtext, the data is fed by a field which holds 2 strings: one for the title and one for the subtext.</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-3.png"><img class="alignnone size-full wp-image-601" title="Some ordindary cells" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-3.png" alt="Ordinary Cells" width="132" height="200" /></a></p>
<p>The code that styles the above cell (BNSubtextTableFieldCell) looks like this:</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-5.png"><img class="alignnone size-full wp-image-783" title="Code used to style basic cells with title and subtext" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-5.png" alt="Code used to style basic cells with title and subtext" width="589" height="341" /></a></p>
<p>And the field that feeds that cell looks like this (in the Three20 source code):</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-7.png"><img class="alignnone size-full wp-image-802" title="Code used to feed data to basic cells with title and subtext" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-7.png" alt="aaa" width="589" height="435" /></a></p>
<h2>JUST changing a cell&#8217;s appearance.</h2>
<p>To change the colors, font sizes, etc in a particular cell, all you need to do is subclass that cell (in this case BNSubtextTableFieldCell), and change it&#8217;s label&#8217;s properties.</p>
<ol>
<li>
<p>To subclass <strong>BNSubtextTableFieldCell</strong>, make <strong>BNCell.h</strong> looks like this:</p>
<pre name="code" class="objc">#import "Three20/Three20.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////
//////   BNSubtextTableFieldCell     ////
/////////////////////////////////////////

@interface BNSubtextTableFieldCell : TTSubtextTableFieldCell {

}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleTableFieldCell     ////
/////////////////////////////////////////////////////

@interface BNSubtextWithRedTitleTableFieldCell : BNSubtextTableFieldCell {

}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////
</pre>
</li>
<li>
<p>Then make <strong>BNCell.m</strong> look like this:</p>
<pre name="code" class="objc">#import "BNCell.h"
#import "BNDefaultStylesheet.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////
//////   BNSubtextTableFieldCell     ////
/////////////////////////////////////////

@implementation BNSubtextTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		TTSubtextTableField* field = object;

		_label.text = field.text;
		_label.font = TTSTYLEVAR(myFirstFont);
		_label.textColor = TTSTYLEVAR(myFirstColor);
		_label.adjustsFontSizeToFitWidth = YES;

		_subtextLabel.text = field.subtext;
		_subtextLabel.font = TTSTYLEVAR(mySecondFont);
		_subtextLabel.textColor = TTSTYLEVAR(mySecondColor);
	}
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleTableFieldCell     ////
/////////////////////////////////////////////////////

@implementation BNSubtextWithRedTitleTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		_label.textColor = [UIColor redColor];
	}
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////
</pre>
<p>All we did there was change the <strong>textColor</strong> property of the cell&#8217;s _label to an ugly ass red color.</p>
</li>
<li>
<p>Next we change the <strong>cellForClassObject</strong> method in <strong>RootViewDataSource.m </strong>to point to your new BNSubtextWithRedTitleTableFieldCell cell type.</p>
<p>Make the RootViewDataSource.m look like this:</p>
<pre name="code" class="objc">#import "RootViewDataSource.h"
#import "BNCell.h"

@implementation RootViewDataSource

///////////////////////////////////////////////////////////////////////////////////////////////////
// public

+ (RootViewDataSource*)rootViewDataSource {
	RootViewDataSource* dataSource =  [[[RootViewDataSource alloc] initWithItems:
									 [NSMutableArray arrayWithObjects:
									 [[[TTSubtextTableField alloc] initWithText:@"Video" subtext:@"Now you can shoot video, edit it, and share it — all on your iPhone 3G S."] autorelease],
									 [[[TTSubtextTableField alloc] initWithText:@"3-Megapixel Camera" subtext:@"The new 3-megapixel camera takes great still photos, too, thanks to built-in autofocus."] autorelease],
									 [[[TTSubtextTableField alloc] initWithText:@"Search" subtext:@"Find what you’re looking for across your iPhone, all from one convenient place."] autorelease],
									 [[[TTSubtextTableField alloc] initWithText:@"Compass" subtext:@"With a built-in digital compass, iPhone 3G S can point the way."] autorelease],
									 [[[TTSubtextTableField alloc] initWithText:@"Cut, Copy &amp; Paste" subtext:@"Cut, copy, and paste words and photos, even between applications."] autorelease],
									 nil]] autorelease];

	return dataSource;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)dealloc {
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource

- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 

	if ([object isKindOfClass:[TTSubtextTableField class]]) {
		return [BNSubtextWithRedTitleTableFieldCell class];
	} else {
		return [super tableView:tableView cellClassForObject:object];
	}
}

- (void)tableView:(UITableView*)tableView prepareCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath {
	cell.accessoryType = UITableViewCellAccessoryNone;
}

@end
</pre>
</li>
</ol>
<p><strong>You should end up with something like this when you run your app:</strong></p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-2.png"><img style="border: 0px initial initial;" title="Ordindary cells with red title" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-2.png" alt="Ordindary cells with red title" width="132" height="200" /></a></p>
<p><strong>Changing a cell&#8217;s appearance AND data.</strong></p>
<p>What if we want to add another piece of data to the cell like a URL? Right now the cell can only be fed a title, and subtext because that is all that the cell&#8217;s field contains (2 NSStrings).</p>
<p>What we have to do is subclass Three20&#8217;s existing TTSubtextTableField (which currently feeds both BNSubtextTableFieldCell and BNSubtextWithRedTitleTableFieldCell) to make a new field which will hold a new piece of data (a NSString for the URL we will add).</p>
<p>But before we make a new field, let&#8217;s make a new cell that subclasses our last cell with the addition of a new UILabel for the URL.</p>
<ol>
<li>
<p>To make a new sub-classed cell, change <strong>BNCell.h</strong> to look like this:</p>
<pre name="code" class="objc">#import "Three20/Three20.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////
//////   BNSubtextTableFieldCell     ////
/////////////////////////////////////////
we
@interface BNSubtextTableFieldCell : TTSubtextTableFieldCell {

}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleTableFieldCell     ////
/////////////////////////////////////////////////////

@interface BNSubtextWithRedTitleTableFieldCell : BNSubtextTableFieldCell {

}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleAndURLTableFieldCell     ////
///////////////////////////////////////////////////////////

@interface BNSubtextWithRedTitleAndURLTableFieldCell : BNSubtextWithRedTitleTableFieldCell {
  UILabel* _featureURLLabel;
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////</pre>
</li>
<li>
<p>And change <strong>BNCell.m</strong> to look like this:</p>
<pre name="code" class="objc">#import "BNCell.h"
#import "BNField.h"
#import "BNDefaultStylesheet.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////
//////   BNSubtextTableFieldCell     ////
/////////////////////////////////////////

@implementation BNSubtextTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		TTSubtextTableField* field = object;

		_label.text = field.text;
		_label.font = TTSTYLEVAR(myFirstFont);
		_label.textColor = TTSTYLEVAR(myFirstColor);
		_label.adjustsFontSizeToFitWidth = YES;

		_subtextLabel.text = field.subtext;
		_subtextLabel.font = TTSTYLEVAR(mySecondFont);
		_subtextLabel.textColor = TTSTYLEVAR(mySecondColor);
	}
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleTableFieldCell     ////
////////////////////////////////////t/////////////////

@implementation BNSubtextWithRedTitleTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		_label.textColor = [UIColor redColor];
	}
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleAndURLTableFieldCell     ////
////////////////////////////////////t//////////////////////

@implementation BNSubtextWithRedTitleAndURLTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

+ (CGFloat)tableView:(UITableView*)tableView rowHeightForItem:(id)item {
	CGFloat maxWidth = tableView.width - 20;
	BNSubtextWithRedTitleAndURLTableField* field = item;

	CGSize textSize = [field.text sizeWithFont:TTSTYLEVAR(tableSmallFont)
					   constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
					   lineBreakMode:UILineBreakModeWordWrap];
	CGSize subtextSize = [field.subtext sizeWithFont:TTSTYLEVAR(font)
						  constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
	CGSize featureURLSize = [field.featureURL sizeWithFont:[UIFont systemFontOfSize:12]
						  constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];

	return 20 + textSize.height + subtextSize.height + featureURLSize.height;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*)identifier {
	if (self = [super initWithFrame:frame reuseIdentifier:identifier]) {
		_featureURLLabel = [[UILabel alloc] initWithFrame:CGRectZero];
		_featureURLLabel.font = [UIFont systemFontOfSize:11];
		_featureURLLabel.textColor = [UIColor grayColor];
		_featureURLLabel.backgroundColor = [UIColor clearColor];
		_featureURLLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
		_featureURLLabel.textAlignment = UITextAlignmentLeft;
		_featureURLLabel.contentMode = UIViewContentModeTop;
		_featureURLLabel.lineBreakMode = UILineBreakModeWordWrap;
		_featureURLLabel.numberOfLines = 0;
		[self.contentView addSubview:_featureURLLabel];
	}
	return self;
}

- (void)dealloc {
	[_featureURLLabel release];
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// UIView

- (void)layoutSubviews {
	[super layoutSubviews];
	CGFloat maxWidth = self.contentView.width - 20;
	CGSize featureURLSize = [_featureURLLabel.text sizeWithFont:_featureURLLabel.font
						  constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBreakMode:_featureURLLabel.lineBreakMode];
	_featureURLLabel.frame = CGRectMake(10, _subtextLabel.bottom + 5, featureURLSize.width, featureURLSize.height);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewCell

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		BNSubtextWithRedTitleAndURLTableField* field = object;

		_featureURLLabel.text = field.featureURL;
	}
}

@end</pre>
</li>
<p>Then we need to feed data into this new cell by sub-classing TTSubtextTableField.</p>
<li>
<p><strong>Make a new file</strong> called<strong> BNField.m</strong> (check YES to &#8220;Also create BNField.h&#8221;).</p>
</li>
<li>
<p>Then make your new <strong>BNField.h</strong> file look like this:</p>
<pre name="code" class="objc">#import "Three20/Three20.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleAndURLTableField  /////
/////////////////////////////////////////////////////

@interface BNSubtextWithRedTitleAndURLTableField : TTSubtextTableField {
	NSString *_featureURL;
}
@property(nonatomic, retain) NSString *featureURL;
- (id)initWithText:(NSString*)text subtext:(NSString*)subtext featureURL:(NSString*)featureURL;

@end

///////////////////////////////////////////////////////////////////////////////////////////////////</pre>
</li>
<li>
<p>And make your <strong>BNField.m</strong> file look like this:</p>
<pre name="code" class="objc">#import "BNField.h"
#import "BNCell.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////
//////   BNSubtextWithRedTitleAndURLTableField     /////
////////////////////////////////////////////////////////

@implementation BNSubtextWithRedTitleAndURLTableField

@synthesize featureURL = _featureURL;

- (id)init {
	if (self = [super init]) {
		_featureURL = nil;
	}
	return self;
}

- (id)initWithText:(NSString*)text subtext:(NSString*)subtext featureURL:(NSString*)featureURL {
	if (self = [super initWithText:text subtext:subtext]) {
		self.featureURL = featureURL;
	}
	return self;
}

- (void)dealloc {
	[_featureURL release];
	[super dealloc];
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////</pre>
</li>
</ol>
<p>Then we have to make some changes to <strong>RootViewDataSource.m</strong><br />
 We will:</p>
<ul>
<li>Include BNField.h</li>
<li>Change our datasource method calls from TTSubtextTableField to BNSubtextWithRedTitleAndURLTableField and pass a URL to this new field</li>
<li>Change the cellClassForObject method to look for our new cell type (I should note that we have to change the IF statement so that our newest class is on top otherwise it won&#8217;t be found).</li>
</ul>
<ul>
</ul>
<ol>
<li>
<p>Make your RootViewDataSource.m look like this:</p>
<pre name="code" class="objc">#import "RootViewDataSource.h"
#import "BNCell.h"
#import "BNField.h"

@implementation RootViewDataSource

///////////////////////////////////////////////////////////////////////////////////////////////////
// public

+ (RootViewDataSource*)rootViewDataSource {
	RootViewDataSource* dataSource =  [[[RootViewDataSource alloc] initWithItems:
									 [NSMutableArray arrayWithObjects:
									 [[[BNSubtextWithRedTitleAndURLTableField alloc] initWithText:@"Video" subtext:@"Now you can shoot video, edit it, and share it — all on your iPhone 3G S." featureURL:@"http://www.apple.com/iphone/iphone-3gs/video-recording.html"] autorelease],
									 [[[BNSubtextWithRedTitleAndURLTableField alloc] initWithText:@"3-Megapixel Camera" subtext:@"The new 3-megapixel camera takes great still photos, too, thanks to built-in autofocus." featureURL:@"http://www.apple.com/iphone/iphone-3gs/photos.html"] autorelease],
									 [[[BNSubtextWithRedTitleAndURLTableField alloc] initWithText:@"Search" subtext:@"Find what you’re looking for across your iPhone, all from one convenient place." featureURL:@"http://www.apple.com/iphone/iphone-3gs/search.html"] autorelease],
									 [[[BNSubtextWithRedTitleAndURLTableField alloc] initWithText:@"Compass" subtext:@"With a built-in digital compass, iPhone 3G S can point the way." featureURL:@"http://www.apple.com/iphone/iphone-3gs/maps-compass.html"] autorelease],
									 [[[BNSubtextWithRedTitleAndURLTableField alloc] initWithText:@"Cut, Copy &amp; Paste" subtext:@"Cut, copy, and paste words and photos, even between applications." featureURL:@"http://www.apple.com/iphone/iphone-3gs/cut-copy-paste.html"] autorelease],
									 nil]] autorelease];

	return dataSource;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)dealloc {
	[super dealloc];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource

- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 

	if ([object isKindOfClass:[BNSubtextWithRedTitleAndURLTableField class]]) {
		return [BNSubtextWithRedTitleAndURLTableFieldCell class];
	} else if ([object isKindOfClass:[TTSubtextTableField class]]) {
		return [BNSubtextWithRedTitleTableFieldCell class];
	} else {
		return [super tableView:tableView cellClassForObject:object];
	}
}

- (void)tableView:(UITableView*)tableView prepareCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath {
	cell.accessoryType = UITableViewCellAccessoryNone;
}

@end</pre>
</li>
</ol>
<p>Once you&#8217;re done changing RootViewDataSource.m&#8230;&#8230;</p>
<p><strong>Boom! Your app should look like this when launched:</strong></p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-6.png"><img class="alignnone size-full wp-image-832" title="Custom table cells fed by custom fields." src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-6.png" alt="Custom table cells fed by custom fields." width="132" height="200" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/three20-custom-cells-iphone-tutorial/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The company you keep&#8230;</title>
		<link>http://mattvague.com/the-company-you-keep</link>
		<comments>http://mattvague.com/the-company-you-keep#comments</comments>
		<pubDate>Mon, 22 Jun 2009 22:45:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=566</guid>
		<description><![CDATA[Over the years I have met some damn interesting, and very talented people.
Here are some of their sites

http://www.histerico.net/
http://www.jadennyberg.com/
http://www.darylclaudio.com/
http://www.tngstudio.com/
http://www.ammint.com/
http://www.nintensity.net/
http://www.brandonweese.com/
http://www.jerahdesigns.com/
http://www.evdsluys.com/
http://www.stefangirard.com/
http://www.pixels72.com/
http://www.thomasmearns.com/
http://www.juansolanoy.com/
http://www.nerissadesign.com/
http://www.gregbelldesign.com/
http://www.derekkehler.com/
http://www.johngiannakos.com/

]]></description>
			<content:encoded><![CDATA[<p><strong>Over the years I have met some damn interesting, and very talented people.</strong></p>
<p>Here are some of their sites</p>
<ul>
<li><a href="http://histerico.net">http://www.histerico.net/</a></li>
<li><a href="http://www.jadennyberg.com">http://www.jadennyberg.com/</a></li>
<li><a href="http://www.darylclaudio.com/">http://www.darylclaudio.com/</a></li>
<li><a href="http://www.tngstudio.com/">http://www.tngstudio.com/</a></li>
<li><a href="http://www.ammint.com/">http://www.ammint.com/</a></li>
<li><a href="http://www.nintensity.net/">http://www.nintensity.net/</a></li>
<li><a href="http://www.brandonweese.com/">http://www.brandonweese.com/</a></li>
<li><a href="http://www.jerahdesigns.com/">http://www.jerahdesigns.com/</a></li>
<li><a href="http://www.evdsluys.com/">http://www.evdsluys.com/</a></li>
<li><a href="http://www.stefangirard.com/">http://www.stefangirard.com/</a></li>
<li><a href="http://www.pixels72.com/">http://www.pixels72.com/</a></li>
<li><a href="http://www.thomasmearns.com/">http://www.thomasmearns.com/</a></li>
<li><a href="http://www.juansolanoy.com/">http://www.juansolanoy.com/</a></li>
<li><a href="http://www.nerissadesign.com/">http://www.nerissadesign.com/</a></li>
<li><a href="http://www.gregbelldesign.com/">http://www.gregbelldesign.com/</a></li>
<li><a href="http://www.derekkehler.com/">http://www.derekkehler.com/</a></li>
<li><a href="http://www.johngiannakos.com/">http://www.johngiannakos.com/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/the-company-you-keep/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three20 Stylesheets iPhone Tutorial</title>
		<link>http://mattvague.com/three20-stylesheets-tutorial</link>
		<comments>http://mattvague.com/three20-stylesheets-tutorial#comments</comments>
		<pubDate>Sun, 14 Jun 2009 07:09:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Three20]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=426</guid>
		<description><![CDATA[In this tutorial, I am going to show you how to use CSS like stylesheets in your iPhone Apps.

Right now there is no built-in equivilent to CSS for building iPhone apps, but lucky for us Joe Hewitt has created a way with his Three20 iPhone Library.]]></description>
			<content:encoded><![CDATA[<p><strong>*Note* SOME of this tutorial is now deprecated. </strong>I will be updating this tutorial soon, but until then please refer to my new <a href="http://mattvague.com/three20-tttableitem-tutorial">TableItem tutorial</a> for Step 4 of this tutorial.</p>
<h2>Introduction to Three20 Stylesheets</h2>
<p>In this tutorial, I am going to show you how to use CSS like stylesheets in your iPhone Apps.</p>
<p>If (like me) you&#8217;re coming to the iPhone platform from a Web Design perspective, you should be very familiar with CSS and external stylesheets. Unfortunately right now, there is no built-in equivalent to CSS for building iPhone apps.</p>
<p>Lucky for us <a href="http://joehewitt.com/">Joe Hewitt</a> has created a way with his <a href="http://github.com/joehewitt/three20/tree into/master">Three20</a> iPhone Library. With Three20, you can easily <strong>change something like this:</strong></p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-51.png"><img class="alignnone size-full wp-image-967" title="A screenshot of my sample App WITHOUT three20 stylesheets" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-51.png" alt="A screenshot of my sample App WITHOUT three20 stylesheets" width="132" height="200" /></a></p>
<p><strong>To something like this:</strong></p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-1.png"><img class="alignnone size-full wp-image-521" title="A screenshot of my sample App using three20 stylesheets" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-1.png" alt="A screenshot of my sample App using three20 stylesheets" width="132" height="200" /></a></p>
<p><strong>Using this stylesheet:</strong></p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-4.png"><img class="alignnone size-medium wp-image-523" title="The actual stylesheet in my sample app" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-4-1000x552.png" alt="The actual stylesheet in my sample app" width="300" height="160" /></a></p>
<p>Although I am going to show you some cool features of Three20, I&#8217;m NOT going to show you how to install Three20 in your Apps, nor build a complete App with Three20. Nope, today I&#8217;m only going to show you how to use Three20&#8217;s stylesheet capabilities.</p>
<p>I&#8217;m assuming a basic knowledge of Three20 and an intermediate knowledge of Cocoa and iPhone Dev. I&#8217;m also assuming you already have a UILabel or something to that you want to change the font of.</p>
<p>If you want to get your hands dirty, there is a sample app using this same code on my <a title="My Three20 iPhone Tutorials hosted on GitHub" href="http://github.com/mattvague/three20-iPhone-tutorials/tree/master" target="_blank">GitHub Three20 tutorial repository</a>.</p>
<h2>Let&#8217;s start the show</h2>
<p><strong>First things first, create your stylesheet.</strong></p>
<ol>
<li>
<p>Create a new blank file. Do this by going File &gt;&gt; New File, then clicking NSObject Subclass. Name the file &#8220;BNDefaultStylesheet&#8221; (i like sticking to Three20&#8217;s naming conventions by replacing the abbreviation TT with the abbreviation BN for &#8220;<strong>B</strong>asic <strong>N</strong>avigation&#8221;).</p>
<p>Copy the following code into <strong>BNDefaultStylesheet.h</strong>:</p>
<pre name="code" class="objc">#import "Three20/TTStyleSheet.h"
#import "Three20/TTDefaultStyleSheet.h"

@interface BNDefaultStyleSheet : TTDefaultStyleSheet

@end</pre>
<p>Then copy the following into <strong>BNDefaultStylesheet.m</strong>:</p>
<pre name="code" class="objc">#import "BNDefaultStyleSheet.h"
#import "Three20/TTStyle.h"
#import "Three20/TTShape.h"
#import "Three20/TTURLCache.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

@implementation BNDefaultStyleSheet

@end</pre>
</li>
<li><strong>Register the new stylesheet into the app delegate. </strong>
<p>Do this by making <strong>BasicNavigationAppDelegate.m</strong> look like this:</p>
<pre name="code" class="objc">#import "BasicNavigationAppAppDelegate.h"
#import "RootViewController.h"
#import "Three20/Three20.h"
#import "BNDefaultStyleSheet.h"

@implementation BasicNavigationAppAppDelegate

@synthesize window;
@synthesize navigationController;

#pragma mark -
#pragma mark Application lifecycle

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after app launch 

	[TTStyleSheet setGlobalStyleSheet:[[[BNDefaultStyleSheet alloc]
										init] autorelease]];

	[window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application {
	// Save data if appropriate
}

#pragma mark -
#pragma mark Memory management

- (void)dealloc {
	[navigationController release];
	[window release];
	[super dealloc];
}

@end</pre>
</li>
<li><strong>Make your first font style. </strong>
<p>Add a new font style and color by making <strong>BNDefaultStylesheet.h</strong> look like this:</p>
<pre name="code" class="objc">#import "Three20/TTStyleSheet.h"
#import "Three20/TTDefaultStyleSheet.h"

@interface BNDefaultStyleSheet : TTDefaultStyleSheet

@property(nonatomic,readonly) UIColor* myFirstColor;
@property(nonatomic,readonly) UIFont* myFirstFont;

@end</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, -webkit-fantasy; ">And making <strong>BNDefaultStylesheet.m</strong> look like this:</span></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, -webkit-fantasy;"> </span></p>
<pre name="code" class="objc">#import "BNDefaultStyleSheet.h"
#import "Three20/TTStyle.h"
#import "Three20/TTShape.h"
#import "Three20/TTURLCache.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

@implementation BNDefaultStyleSheet

///////////////////////////////////////////////////////////////////////////////////////////////////
// styles

///////////////////////////////////////////////////////////////////////////////////////////////////
// public colors

- (UIColor*)myFirstColor {
	return RGBCOLOR(80, 110, 140);
}

- (UIColor*)mySecondColor {
	return [UIColor grayColor];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// public fonts

- (UIFont*)myFirstFont {
	return [UIFont boldSystemFontOfSize:15];
}

- (UIFont*)mySecondFont {
	return [UIFont systemFontOfSize:14];
}

@end</pre>
</li>
<li><strong>Use your new style. </strong>
<p>Change the font to point to the font style by making <strong>BNCell.m</strong> look like this:</p>
<pre name="code" class="objc">#import "BNCell.h"
#import "BNDefaultStylesheet.h"

///////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////
//////   BNSubtextTableFieldCell     ////
/////////////////////////////////////////

@implementation BNSubtextTableFieldCell

///////////////////////////////////////////////////////////////////////////////////////////////////

- (void)setObject:(id)object {
	if (_field != object) {
		[super setObject:object];

		TTSubtextTableField* field = object;
		_label.text = field.text;
		_label.font = TTSTYLEVAR(myFirstFont);
		_label.textColor = TTSTYLEVAR(myFirstColor);
		_label.adjustsFontSizeToFitWidth = YES;

		_subtextLabel.text = field.subtext;
	}
}

@end

///////////////////////////////////////////////////////////////////////////////////////////////////</pre>
</li>
</ol>
<p>Voila! You should now have your first App using Three20 Stylesheets. Your App should now have blue labels instead of black ones like so:</p>
<p><a href="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-1.png"><img class="alignnone size-full wp-image-521" title="A screenshot of my sample App WITH three20 stylesheets" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/Picture-1.png" alt="A screenshot of my sample App WITH three20 stylesheets" width="132" height="200" /></a></p>
<p>I&#8217;ll be refining this tutorial in the future, but if you find any glaring omissions please point em out.</p>
<p>AND To people following my tutorials: &#8230; <strong>DON&#8217;T BE SO PROUD</strong>. Ask questions if you have em, I&#8217;m cool with helping you get this stuff working in your Apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/three20-stylesheets-tutorial/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>iPhone Apps by color</title>
		<link>http://mattvague.com/iphone-apps-by-color</link>
		<comments>http://mattvague.com/iphone-apps-by-color#comments</comments>
		<pubDate>Sun, 07 Jun 2009 22:33:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=337</guid>
		<description><![CDATA[Check it out, I was bored on the bus one day and organized my Apps by color

]]></description>
			<content:encoded><![CDATA[<p>Check it out, I was bored on the bus one day and organized my Apps by color</p>
<p>
<a href='http://mattvague.com/iphone-apps-by-color/img_0011' title='Screen 1 - Blue'><img width="150" height="150" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/img_0011-150x150.png" class="attachment-thumbnail" alt="" title="Screen 1 - Blue" /></a>
<a href='http://mattvague.com/iphone-apps-by-color/img_0014' title='Screen 2 - Green'><img width="150" height="150" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/img_0014-150x150.png" class="attachment-thumbnail" alt="" title="Screen 2 - Green" /></a>
<a href='http://mattvague.com/iphone-apps-by-color/img_0016' title='Screen 3 - Orange'><img width="150" height="150" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/img_0016-150x150.png" class="attachment-thumbnail" alt="" title="Screen 3 - Orange" /></a>
<a href='http://mattvague.com/iphone-apps-by-color/img_0017' title='Screen 4 - Black'><img width="150" height="150" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/img_0017-150x150.png" class="attachment-thumbnail" alt="" title="Screen 4 - Black" /></a>
<a href='http://mattvague.com/iphone-apps-by-color/img_0018' title='Screen 5 - White'><img width="150" height="150" src="http://mattvague.com/wordpress/wp-content/uploads/2009/06/img_0018-150x150.png" class="attachment-thumbnail" alt="" title="Screen 5 - White" /></a>

]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/iphone-apps-by-color/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Favorite Feeds: Week of June 1st</title>
		<link>http://mattvague.com/matts-favorite-feeds-week-of-june-1st</link>
		<comments>http://mattvague.com/matts-favorite-feeds-week-of-june-1st#comments</comments>
		<pubDate>Sat, 06 Jun 2009 04:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Feeds & Blogs]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=299</guid>
		<description><![CDATA[Some favorites for the week of  June 1st:

37Signals:  Signal vs. Noise Blog
Appletell
Guy Kawasaki&#8217;s: How to Change the World Blog
Google: Official Blog
 BBC News

]]></description>
			<content:encoded><![CDATA[<p>Some favorites for the week of  June 1st:</p>
<ul>
<li>37Signals:  <a href="http://feeds.feedburner.com/37signals/beMH" target="_blank">Signal vs. Noise Blog</a></li>
<li><a href="http://feedproxy.google.com/appletell" target="_blank">Appletell</a></li>
<li>Guy Kawasaki&#8217;s: <a href="http://feeds2.feedburner.com/guykawasaki/Gypm" target="_blank">How to Change the World Blog</a></li>
<li>Google: <a href="http://googleblog.blogspot.com/feeds/posts/default" target="_blank">Official Blog</a></li>
<li> <a href="http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml" target="_blank">BBC News</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/matts-favorite-feeds-week-of-june-1st/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash is dead!</title>
		<link>http://mattvague.com/flash-is-dead</link>
		<comments>http://mattvague.com/flash-is-dead#comments</comments>
		<pubDate>Sat, 06 Jun 2009 02:39:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Thinkers]]></category>
		<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://mattvague.com/?p=286</guid>
		<description><![CDATA[Is it just me&#8230; or is it sooooooo 2006 to use Flash?
This is 2009! Other than for video players, complex interfaces, crazy-complex animations, AND font replacement (thank you Jonathan), It&#8217;s possible avoid the pitfalls of Flash on most sites. Flash ain&#8217;t very search engine friendly, it&#8217;s needlessly complex, it&#8217;s slow loading, etc, etc.
You can do practically any kind of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Is it just me&#8230; or is it sooooooo 2006 to use Flash?</strong></p>
<p>This is 2009! Other than for video players, complex interfaces, crazy-complex animations, <strong>AND font replacement </strong>(thank you Jonathan), It&#8217;s possible avoid the pitfalls of Flash on most sites. Flash ain&#8217;t very search engine friendly, it&#8217;s needlessly complex, it&#8217;s slow loading, etc, etc.</p>
<p>You can do practically any kind of animation, effect, or interface element with the kick ass Javascript frameworks that are out there like:</p>
<ul>
<li>script.aculo.us (<a href="http://script.aculo.us/">http://script.aculo.us/</a>)</li>
<li>Prototype (<a href="http://www.prototypejs.org/">http://www.prototypejs.org/</a>)</li>
<li>Moo Tools (<a href="http://www.mootools.net/">http://www.mootools.net/</a>)</li>
<li>jQuery (<a href="http://jquery.com/">http://jquery.com/</a>)</li>
</ul>
<p>And even if you&#8217;re a Microsoft-nut you can use Silverlight (<a href="http://silverlight.net/">http://silverlight.net/</a>) to do pretty much anything Flash can do, while keeping your site Googleable. But on the other hand you would have to use .net&#8230; ughh&#8230; not to mention Silverlight doesnt support H.264 video encoding &#8230; super ughh.</p>
<p><strong>Maybe it IS just me&#8230; </strong>but when I see sites where Flash is used for things that could easily be done with Javascript like animated menus, simple image galleries, carousells, etc I can&#8217;t help but think that these folks are behind the times.</p>
<p>So in conclusion: <strong>Let go of your Flash happiness, and embrace La Revolution.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://mattvague.com/flash-is-dead/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
