【发布时间】:2016-01-18 19:02:46
【问题描述】:
如图所示,我试图在 tableview 函数之外重新声明数组。我还尝试从我希望数组所在的类中调用ViewController.tableView()。我想我需要知道的是如何将数组从 tableview 中取出到其他任何东西中。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier ("BasicCell")
let keyTitle = keys[indexPath.row].keyTitle
let keyItself = keys[indexPath.row].keyItself
var keyArray = []
keyArray = keyItself
cell.textLabel?.text = keyTitle
return cell
}
var theKey: Array = keyItself
【问题讨论】:
-
我不明白函数是如何工作的。我终于知道我的愚蠢了。你可以让函数拉入可以解决我的问题的数据。我不明白我没有视图控制器类,而是一个单独的类。感谢大家的帮助。
标签: arrays swift uitableview