简体   繁体   中英

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

I'm trying to learn how to use storyboards but am having a problem with control-dragging from my Table View to the detail view; it basically, doens't auto-connect like I have something configure wrong.

Here's what it kinda looks like: 在此处输入图片说明

Should I even be able to do this?

Here's my code for cell creation:

-(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;
}

Here's the code in my view controller (although this wouldn't seem relevant):

-(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"];
}

thx fo

如果在从表视图中选择一个单元格时正在查找详细信息视图,则应控制从表视图控制器中的单元格拖动并连接到详细信息viewController。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM