簡體   English   中英

無法控制從表視圖拖動到情節提要中的詳細信息視圖

[英]Not able to control-drag from a Table View to a detail view in a storyboard

我正在嘗試學習如何使用情節提要,但是在將控件從表視圖拖到詳細信息視圖時遇到了問題。 基本上,它不會像我的配置錯誤一樣auto-connect

看起來像這樣: 在此處輸入圖片說明

我是否應該能夠做到這一點?

這是我創建單元格的代碼:

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  static NSString *CellIdentifier=@"MyCell";
  UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if(cell==nil){
    cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  }
  cell.textLabel.text=self.tasks[indexPath.row];
  return cell;
}

這是我的視圖控制器中的代碼(盡管這似乎無關緊要):

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  [self performSegueWithIdentifier:@"taskSegue" sender:self.tasks[indexPath.row]];
}

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
  UIViewController *destination = segue.destinationViewController;
  if([segue.identifier isEqualToString:@"taskSegue"])
    [destination setValue:sender forKeyPath:@"task"];
  else
    destination = [segue.destinationViewController topViewController];

  [destination setValue:self forKeyPath:@"delegate"];
}

謝謝

如果在從表視圖中選擇一個單元格時正在查找詳細信息視圖,則應控制從表視圖控制器中的單元格拖動並連接到詳細信息viewController。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM