
我正在使用 Xcode 构建一个“实用程序应用程序”,上面是从主视图控制器翻转时可以看到的视图屏幕截图。此UITableView视图内部将委托和源设置UIViewController为包含视图,表数据被适当填充(暗示uiviewcontroller作为数据源的行为正确)但是表不响应任何事件,即委托方法不被叫到桌子上。我什至无法为表格选择任何行。
对此的任何帮助将不胜感激。
是的,userInteractionEnabled 设置为 YES。这里也是生成单元格的代码
-(UITableViewCell*)populateFeatureCell:(UITableView*)tableView 行:(NSUInteger)row {
NSString *CellIdentifier = @"FeatureCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
SKProduct *product = [STLNavigatorIAPHelper productAtIndex:row];
if (product != nil) {
cell.textLabel.text = [product localizedTitle];
UIButton *buyButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buyButton.frame = CGRectMake(0, 0, 72, 37);
[buyButton setTitle:NSLocalizedString(@"BUY", nil) forState:UIControlStateNormal];
buyButton.tag = row;
[buyButton addTarget:self action:@selector(buyButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.accessoryView = buyButton;
}
[cell setUserInteractionEnabled:YES];
return cell;
}