I have been banging my head on adding a button to a cell. This is what I have done.
I subclassed TTTableMessageItem and TTTableMessageItemCell.
I added the following method to the Message Item init :
+ (id)itemWithTitle:(NSString *)title caption:(NSString *)caption text:(NSString *)text timestamp:(NSDate *)timestamp imageURL:(NSString *)imageURL URL:(NSString *)URL target:(id)target action:(SEL)action;
I also added a SEL variable and “id” for action and target.
Under setObject in message Item Cell I added this :
- (void)setObject:(id)object {
if (_item != object) {
[super setObject:object];
TJTableMessageItem* item = object;
if (item.plusAction) {
self.plusAction = item.plusAction;
}
if (item.plusTarget) {
self.plusTarget = item.plusTarget;
}
}
}
I am now able to trigger easily a method inside my datasource for the tableview. But I am not able to find out which cell was pressed. I hope someone can help me, I have spent way to much time figuring out the setObject part.
I would like to know how and add a subview like the Facebook app has, the Like, Comment part. I think I need to be able to run a method inside the view controller. But I can’t find anything anywhere. The Cybersam blog has an explanation that doesn’t use the TableItem and TableItemCell like Three20 puts things up.
assume that the target is your TableViewController, and the the SEL has an argument named sender, like this:
then you can find the Cell View according to sender (sender.superView…..), and use the TableView to find the cell’s index, that’s all.