I hope you already know about iPhone framework
Three20. Sometimes you have to change a table cell for your special needs. This post describes how to manage it.
Let's suppose you have to take out timestamp label from
TTTableMessageItemCell. I'll describe process step by step.
1. Inherit
TTTableMessageItemCell and create your own class, say
FruitItemCell. And rewrite method
setObject:
@implementation FruitItemCell
- (void)setObject:(id)object {
[super setObject:object];
self.timestampLabel.hidden = YES;
self.timestampLabel.text = @"";
}
Looks great isn't it? But it is not time to fun. Because now you have to make the framework to involve your new awesome class into process. The next step is about it.
2. Create correct table cells in your datasource:
@implementation FruitDataSource
...
- (Class)tableView:(UITableView*)tableView cellClassForObject:(id)object {
if ([object isKindOfClass:[TTTableMessageItem class]]) {
return [FruitItemCell class];
}
return [super tableView:tableView cellClassForObject:object];
}
Now the framework will create correct cell instances for your data items.