2012-08-17 48 views
1

为了显示我的自定义长tableViewCell中的内容,我创建了一个滚动视图,并添加了无法滚动的tableView在我的滚动视图中tableviewcell是一种我自定义的tableviewcell。为什么有一个提示崩溃“无法识别的选择器tableView:didSelectRowAtIndexPath”

我TollStatusViewController.h

UITableView *selfTableView; 
@property (retain, nonatomic) IBOutlet UIScrollView *fluxScrollView; 

在我TollStatusViewController.m

self.fluxScrollView.clipsToBounds = YES; 
self.fluxScrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack; 
[self.fluxScrollView setContentSize:CGSizeMake(1400.0, 154.0)]; 

selfTableView = [[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 1400.0, 154.0) style:UITableViewStylePlain] autorelease]; 
selfTableView.dataSource = self; 

selfTableView.delegate = self; 
selfTableView.scrollEnabled = NO; 
[self.fluxScrollView addSubview:selfTableView]; 

和委托方法:

#pragma mark tableview-data-source 

- (NSInteger)tableView:(UITableView *)_tableView numberOfRowsInSection:(NSInteger)section 
{ 
    return 3; 
} 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)_tableView 
{ 
    return 1; 
} 

- (CGFloat)tableView:(UITableView *)_tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (indexPath.row == 0) { 
     return 38.0; 
    } 
    if (indexPath.row == 1) { 
     return 56.0; 
    } 
    if (indexPath.row == 2) { 
     return 56.0; 
    } 
    return 0; 
} 

- (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    ManyColumnsViewCell *cellView = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cellView == nil) { 
     cellView = [[[ManyColumnsViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
    } 


    return cellView; 
} 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

} 

然后我就可以让我的fluxScrollView水平滚动所以我可以在我的long manyColumnsViewCell中显示内容。

但是当点击一个行中的tableView,有一个与提示

2012-08-17 15:43:14.789 MScope[2261:13a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x7e87960' 

崩溃后,我删除此功能

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 

    } 

没有崩溃。

回答

1

最投票回答here

我TollStatusViewController被临时建的,所以我保持在其在对象的函数对象和dealloc的 - (空)dealloc的,那么这将是罚款。

相关问题