1
我使用的“动态原型”的UITableView针对我生成表格单元如下的UIButton嵌入cell.accessoryVIew没有响应
-(UITableViewCell*)populateFeatureCell:(UITableView*)tableView row:(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; }
我能够看到细胞中的表,但在细胞不响应任何事件。请注意,函数buyButtonTapped也已被定义。