0

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: enter image description here

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

4

1 回答 1

1

如果您在从 tableview 中选择一个单元格时正在寻找详细视图,您应该控制从 tableview 控制器中的单元格拖动并连接到您的详细视图控制器。

于 2013-06-09T19:34:14.977 回答