Reputation: 34
I'm trying to set the value of the cell to a text value of a label that I place in the Main.storyboard, however after updating to Xcode 6.2 it start giving me an error that "UILabel doesn't have a member named text" before the update everything was working fine.
this is the code that I have
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
Upvotes: 0
Views: 483
Reputation: 2189
Put a ? after textLabel; Xcode expects an Optional here. Not sure what in the update would have changed that, but if I take the ? out of my similar code thats same error I see. I believe that Xcode automatically suggested the ? in the previous version.
Upvotes: 3