As you maybe have guessed this post is about the Three20 framework which has been developed for iPhone development. At this point it is only fair recognise Chris McClelland from Ecliptic Labs as being the person that introduced me to it. At the time of my first introduction I hated it with a passion, I felt that it restricted you too much and didn’t give enough benefits. Due to an extremely tight project schedule and against my better judgement we decided to use TT for the City Of Culture application that we wrote for the Londonderry~Derry bid to be the City Of Culture 2013. During the development things finally clicked into place. I suppose I should have known better than to doubt Chris.
Even the creators of TT admit that there are some situations that it really doesn’t suit but if you have a project that required information to be gathered from remote sources then it deserves a long hard look. There are loads of examples that come along with the source for TT but the example which downloads posts from Twitter is an excellent place to start.
I have also found it to be an excellent way to layout simple pages like about screens etc. Below is an example of one that I created for the City Of Culture.
@implementation TellAStoryIntroViewController
- (void)dealloc {
[super dealloc];
}
- (id)init {
if (self = [super init]) {
self.tableViewStyle = UITableViewStyleGrouped;
TTImageView *backgroundImage = [[TTImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)];
[backgroundImage setUrlPath:@"bundle://background2.png"];
[self.view insertSubview:backgroundImage atIndex:0];
[backgroundImage release];
self.tableView.backgroundColor = [UIColor clearColor];
self.title = @”Tell A New Story”;
self.variableHeightRows = YES;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 280, 230)];
label.text = @”In the 1920s, Ernest Hemingway bet ten dollars that he could write a complete story in just six words. He wrote:\n\n\”For Sale: baby shoes, never worn.\”\n\nHe won the bet and a legenderry story was born…tell us your cultural story in six words.”;
label.font = [UIFont systemFontOfSize:16];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor darkGrayColor];
label.left = 20;
label.numberOfLines = 20;
[view addSubview:label];
self.tableView.tableHeaderView = view;
[label release];
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
@"",
[TTTableTextItem itemWithText:@"Tell Your Story"
URL:@"tt://tellAStory"
accessoryURL:nil],
[TTTableTextItem itemWithText:@"More information"
URL:kTellAStoryInstructionLink
accessoryURL:nil],
nil];
}
return self;
}
@end
All of this code gives you a screen like this.

And I really do mean that, what I put in above is all the code within the ViewController. All you have to do is inherit from TTTableViewController. If I get some time over the next few weeks I will post some more example of our implementations using TT.
As for the answer to the question in the title, as long as you have weighed up the pros and cons, yes, do Three20.
Stu
Continue reading