Bja*_*rte 6 interface-builder segue swift
我有一个custom cell class和一个custom nib包含该单元格的设计.在我的storyboard我没有看到连接的方式tableview为segue(就像你有一个原型细胞)我有没有因为我的电池是通过增加tableView:cellForRowAtIndexPath.
有没有办法让这个segue连接,所以我可以继续使用故事板连接单元格到详细视图控制器?
这是我的代码tableView:cellForRowAtIndexPath:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell") as MyTableViewCell?
if (cell == nil) {
tableView.registerNib(UINib(nibName: "MyTableViewCell", bundle: NSBundle(identifier: "com.company.InterfaceComponents")), forCellReuseIdentifier: "cell")
cell = tableView.dequeueReusableCellWithIdentifier("cell") as MyTableViewCell?
}
return cell!
}
Run Code Online (Sandbox Code Playgroud)
我发现我可以做的是添加一个手动segue(通过从控制器拖动)到细节控制器(显示带有标识符的segue:"showDetails").然后我可以在我的表视图上添加以下代码:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.performSegueWithIdentifier("showDetails", sender: tableView)
}
Run Code Online (Sandbox Code Playgroud)
哪个会给我我想要的功能.
| 归档时间: |
|
| 查看次数: |
4059 次 |
| 最近记录: |