Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 获取父单元格标签_Ios_Swift_Parent_Tableviewcell - Fatal编程技术网

Ios 获取父单元格标签

Ios 获取父单元格标签,ios,swift,parent,tableviewcell,Ios,Swift,Parent,Tableviewcell,我在TableViewCell中放置了一个按钮,该按钮触发一个动作,将数据传递给另一个ViewController,并显示它。有没有办法访问我单击的特定单元格的标签 正在从API创建和填充单元格 例如,我有10个单元格,里面都有不同的标签。我需要访问我单击的单元格的标签(或者我单击的按钮是子单元格),并将此数据传递给我的其他ViewController 干杯 我通过从API中给按钮标签一个ID并将其传递给另一个运行正常的ViewController解决了这个问题,我刚刚解决了这个问题: over

我在
TableViewCell
中放置了一个按钮,该按钮触发一个动作,将数据传递给另一个
ViewController
,并显示它。有没有办法访问我单击的特定单元格的标签

正在从API创建和填充单元格

例如,我有10个单元格,里面都有不同的标签。我需要访问我单击的单元格的标签(或者我单击的按钮是子单元格),并将此数据传递给我的其他
ViewController


干杯

我通过从API中给按钮标签一个ID并将其传递给另一个运行正常的
ViewController
解决了这个问题,我刚刚解决了这个问题:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {

        let indexPath = self.tableView.indexPathForSelectedRow()
        let cell = self.historyViewTable.cellForRowAtIndexPath(indexPath!) 
        println(cell.cellLabel.text!)
    }