小编Cha*_*Woo的帖子

从每个UITableView Cells Swift获取数据

我无数次搜索过互联网,并没有找到解决方案.可能解决的问题是我不理解的事情,而且它们都在Objective-C中.因此,如果这是重复,则不是.我没有从其他帖子中获得解决方案.

我正在为我的学校专门制作GPA计算器,根据我们的学科水平我们得到不同的分数.

我制作了一个带有自定义单元格的UITableView,该单元格将为成绩中的每个主题重复特定次数.

我想知道的是从每个自定义单元格中获取数据(分数和级别)

这是我的故事板:

故事板

这是我在模拟器中预览的应用程序:

应用截图

我将通过获取每个科目中的标签文本来获得分数和水平,我不知道如何从特定细胞获取数据.

非常感谢你.

这是我目前的代码:

//showStepperValueLabel shows the level and showSliderValueLabel shows the score in the cells.
//customCell is my custom class for my custom cell.
//i have already declared the levels and scores array above in my class

func tableView(tableView: UITableView!, didDeselectRowAtIndexPath indexPath: NSIndexPath!) {
    let cell = tableView.cellForRowAtIndexPath(indexPath) as customCell
    var level: String! = cell.showStepperValueLabel.text
    var score: String! = cell.showSliderValueLabel.text
    levels[indexPath.row] = level
    scores[indexPath.row] = score

}


//yadiyadayada 



//and this is the part where …
Run Code Online (Sandbox Code Playgroud)

ios swift

5
推荐指数
1
解决办法
4万
查看次数

标签 统计

ios ×1

swift ×1