[英]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.