簡體   English   中英

didSelectRowAtIndexPath沒有被TTTableViewController調用

[英]didSelectRowAtIndexPath not being called with TTTableViewController

挑戰:如果用戶觸摸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

您無需更改委托即可進行簡單的操作。 只需在您的控制器中實現此方法:

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

來源:我做到了...和three20源文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM