2010-02-15 64 views
0

挑戰: 我想要做一些操作,如果用戶觸摸TableItem。didSelectRowAtIndexPath不被TTTableViewController調用

問題: 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 

回答

2

你並不需要更改委託簡單的操作。只需在您的控制器實現此方法:

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

來源:我做它... the three20 source file

+0

呀,謝謝! – fabian

相關問題