Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCell not showing detailTextLabel.text - Swift

The detail (subtitle) text does not appear. The data are available, though, because when a println() call is added, it prints Optional("data") to the console with the expected data. In the storyboard, the UITableViewController is set to the proper class, the Table View Cell Style is set to 'Subtitle', and the reuse identifier is set to 'cell'. How can I get the subtitle information to display?

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {      var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell      dispatch_async(dispatch_get_main_queue(), { () -> Void in          cell.textLabel.text = self.myArray[indexPath.row]["title"] as? String         cell.detailTextLabel?.text = self.myArray[indexPath.row]["subtitle"] as? String          println(self.myArray[indexPath.row]["subtitle"] as? String)         // The expected data appear in the console, but not in the iOS simulator's table view cell.      })     return cell } 
like image 967
kurple Avatar asked Dec 01 '14 02:12

kurple


1 Answers

Your code looks fine. Just goto the storyboard and select the cell of your tableview -> Now goto Attributes Inspector and choose the style to Subtitle.

Follow this according to the below screenshot.

Change this option

Hope it helped..

like image 52
onCompletion Avatar answered Sep 23 '22 01:09

onCompletion