【发布时间】:2015-05-15 11:06:16
【问题描述】:
我正在尝试将单元格的值设置为我放置在 Main.storyboard 中的标签的文本值,但是在更新到 Xcode 6.2 后它开始给我一个错误“UILabel 没有名为 text 的成员”在更新之前一切正常。
这是我的代码
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.personajes.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = UITableViewCell()
cell.textLabel.text = self.personajes[indexPath.row]
return cell
【问题讨论】:
-
您应该考虑使用
dequeueReusableCell,而不是每次都初始化一个新单元格
标签: ios objective-c xcode swift uilabel