Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableView与SKSTableViewCell选择问题_Ios_Uitableview_Custom Cell - Fatal编程技术网

Ios UITableView与SKSTableViewCell选择问题

Ios UITableView与SKSTableViewCell选择问题,ios,uitableview,custom-cell,Ios,Uitableview,Custom Cell,我用的是a,一切正常。我遇到了一个问题,找不到解决的办法 当我展开第一个和第二个单元格,然后从第一个展开的子行单元格中进行选择时,我将获得第二个行名称和第一个选定的子行名称。我应该得到的是第一个名称,而不是第一个子行名称。我如何解决这个问题 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ SKSTableViewCell *cell = (SKSTabl

我用的是a,一切正常。我遇到了一个问题,找不到解决的办法

当我展开第一个和第二个单元格,然后从第一个展开的子行单元格中进行选择时,我将获得第二个行名称和第一个选定的子行名称。我应该得到的是第一个名称,而不是第一个子行名称。我如何解决这个问题

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

  SKSTableViewCell *cell = (SKSTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
  UITableViewCell *selectedCell = [self tableView:_tableView cellForSubRowAtIndexPath:indexPath];
  _selectedCellTxt = selectedCell.textLabel.text;

  if ([cell respondsToSelector:@selector(isExpandable)]){

      if ([cell isExpandable])
      {
          NSLog(@"SELECTED Row %@", _selectedCellTxt);
      }

  else{
         _selectedCellTxt = selectedCell.textLabel.text
         [self performSegueWithIdentifier:@"123" sender:self];
    }
}

- (void)tableView:(SKSTableView *)tableView didSelectSubRowAtIndexPath:(NSIndexPath *)indexPath{

  UITableViewCell *selectedCell = [self tableView:_tableView cellForSubRowAtIndexPath:indexPath];
  _selectedSubCellTxt = selectedCell.textLabel.text;
  NSLog(@"SELECTED Sub Row %@", _selectedSubCellTxt);

  [self performSegueWithIdentifier:@"123" sender:self];
}

这就是我通过调用
didselectsubwatindexpath
中的
cellForRowAtIndexPath
来解决问题的方法

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

    SKSTableViewCell *cell = (SKSTableViewCell *)[self tableView:_tableView cellForRowAtIndexPath:indexPath];
    UITableViewCell *selectedCell = [self tableView:_tableView cellForRowAtIndexPath:indexPath];
    _selectedCellTxt = selectedCell.textLabel.text;
}

- (void)tableView:(SKSTableView *)tableView didSelectSubRowAtIndexPath:(NSIndexPath *)indexPath{

  UITableViewCell *selectedSubCell = [self tableView:_tableView cellForSubRowAtIndexPath:indexPath];
  _selectedSubCellTxt = selectedSubCell.textLabel.text;

  UITableViewCell *selectedCell = [self tableView:_tableView cellForRowAtIndexPath:indexPath];
  _selectedCellTxt = selectedCell.textLabel.text;

  [self performSegueWithIdentifier:@"123" sender:self];
}

@抱歉什么意思?我在选择单元格时总是得到想要的结果。无法复制:“我使用第一个选定的子行名称获取第二行名称。”