【发布时间】:2016-08-13 09:11:49
【问题描述】:
我需要在 TableView 中设置部分。每个部分都有不同的值类型,请参阅我的代码。但它不起作用。请建议在部分中设置值的正确方法。请参阅屏幕截图以获取错误消息。注意:我删除了 var detailsInSection 末尾的“)”,因为它无法正确显示。
var sectionTitles = ["WebSite", "Date Saved", "Document Used","Add Notes"]
var detailsInSection = [([String], [NSDate],[AnyObject],[String])]()
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return detailsInSection[section].count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("DetailsCell")
cell?.textLabel!.text = detailsInSection[indexPath.section][indexPath.row]
return cell!
}
【问题讨论】:
-
您好,返回 true,谢谢,请在 var detailsInSection 末尾添加一半“)”。
-
迈克,请使用edit 按钮自己完成。 :) 谢谢。
-
完成。我以为我没有权限。
-
您总是在自己的帖子上。在其他情况下,它确实与您的声誉得分有关。
标签: ios swift uitableview