1
爲了顯示我的自定義長tableViewCell中的內容,我創建了一個滾動視圖,並添加了無法滾動的tableView在我的滾動視圖中tableviewcell是一種我自定義的tableviewcell。爲什麼有一個提示崩潰「無法識別的選擇器tableView:didSelectRowAtIndexPath」
我TollStatusViewController.hUITableView *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
{
}
沒有崩潰。