使用TTTableViewController不调用didSelectRowAtIndexPath

时间:2010-02-15 17:46:47

标签: ios objective-c iphone uitableview three20

挑战: 如果用户触摸TableItem,我想做一些动作。

问题:从不调用didSelectRowAtIndexPath方法?我错过了什么吗?


PortfolioViewController.h

@interface PortfolioViewController : TTTableViewController <TTTableViewDelegate> 
{

}

@end

PortfolioViewController.m

@implementation PortfolioViewController

- (id)init {
 if (self = [super init]) {
  self.title = @"Portfolio";
  self.tableViewStyle = UITableViewStylePlain;
  self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth| UIViewAutoresizingFlexibleHeight;
  self.variableHeightRows = YES;  

  PortfolioDataSource *ds = [[[PortfolioDataSource alloc] init] autorelease];
  CasesModel *cm = [[[CasesModel alloc] init] autorelease];
  ds.model = cm; 

  self.dataSource = ds;
 }
 return self;
}

#pragma mark -
#pragma mark Table Delegate Methods
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
 NSLog(@"touched");
}

@end

1 个答案:

答案 0 :(得分:2)

您无需为简单操作更改委托。只需在控制器中实现此方法:

- (void)didSelectObject:(id)object atIndexPath:(NSIndexPath*)indexPath;

来源:我这样做...... the three20 source file