In UITableView, cell.detailTextLabel.text isn't working… why?

uitableviewcell detailtextlabel swift
uitableviewcell not showing text
detailtextlabel not showing swift 4
uitableviewcell value1
uitableviewcell right detail
uitableviewcell(style programmatically swift)
subtitle cell programmatically swift
uitableview lifecycle swift

In tableView:cellForRowAtIndexPath: I have the following:

cell.textLabel.text = @"label";
cell.detailTextLabel.text = @"detail";

The textLabel shows as expected, but the detailTextLabel doesn't appear at all, although there is no diagnostic. What I expected was that the "detail" text would appear in the cell on a second line, below the "normal" text, possibly with a smaller font size.

The same question is asked in another posting here and user "jbrennan" answered that the tableview cell style must be something other than UITableViewCellStylePlain. However, it seems there are only two possible styles, UITableViewCellStylePlain and UITableViewCellStyleGrouped. I get the same result with either (the detail label doesn't appear).

Is there another cell style that I'm not seeing in the documentation? Did UITableView change in the last update and detailTextLabel is no longer available? Do I have to do something extra to make it appear? Any suggestions?

I'm using xcode 3.2.5 and building for iPhone 4.2 Simulator.

Your initialization needs to be changed to this:

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle                                reuseIdentifier:CellIdentifier] autorelease];

I've emphasized and bolded the part you need to change.

detailTextLabel, UITableViewCell adds an appropriate label when you create the cell in a style that supports secondary labels. If the style doesn't support detail labels, nil is  cell.textLabel.text = @"label"; cell.detailTextLabel.text = @"detail"; The textLabel shows as expected, but the detailTextLabel doesn't appear at all, although there is no diagnostic. What I expected was that the "detail" text would appear in the cell on a second line, below the "normal" text, possibly with a smaller font size.

You need to set the cell type to Subtitle when you allocate it.

if (!cell) {
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:BasicCellIdentifier];

detailTextLabel not showing a date |Apple Developer Forums, In the table view, I am having trouble getting a date to show. If I write something simple like: cell.detailTextLabel?.text = "This is a test". then that  If you are making your own stuff, doing your own work and trying to sell it in the market, most advice isn't enough. You want it to work. You want to sell your works to those who most are touched by them.

When using Xcode 4.2, set the Table View Cell style to Subtitle in Storyboard. dequeueReusableCellWithIdentifier will return an instantiated cell.

Example code for Table View in Swift · GitHub, let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: cell.detailTextLabel.text = "Subtitle #\(indexPath.row)". return cell kosher. cell.textLabel.text is what all the cool kiddies are doing these days. Tag: ios,uitableview,swift I've skimmed through a variety of tutorials and posts on this subject, but I can't seem to get a resolution working for my project. Essentially, I am trying to implement a "pull to refresh" in my TableView on iOS, which would then reload some data via a web server and then reload my table with the latest dataset.

Set the table View Cell Style to Subtitle in Storyboard

and write this code to configure you cell

if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:BasicCellIdentifier] autorelease];

UITableViewCell not showing detailTextLabel.text, 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  Why doesn't a UITableView scroll until I have 2 additional rows? ios,uitableview. UIScrollView (from which UITableView inherits) has a alwaysBounceVertical property. If you set this to true, either in code or Storyboard, the table view will be vertically 'scrollable' regardless of how many rows it has.

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 

Table views basics (Swift) – Tutorials, Technically, a table view is the view object that displays a table's data Detail text label This is the cell's secondary text, usually used as an  Table views on any mobile platform are the workhorse of any application. To be a good developer you need to make table views easily. Tables in iOS use the UITableView class to do so. This is a ve…

Customizing a Table's Appearance in Xamarin.iOS, The cell style is set in the UITableViewCell constructor, like this: C# Row].​Heading; cell.DetailTextLabel.Text = tableItems[indexPath.Row]. ios,uitableview. viewWithTag: is a very fragile way to get a reference to views, and isn't recommended. But what I think is happening is that you need to call viewWithTag: on cell.contentView rather than the cell itself. I'd recommend creating proper IBOutlets to hold your imageview and label.

Topic: Detailtextlabel uitableview tutorial, The Jordan Bike Trail is a 720-kilometer cycling trail crossing and connecting the length of Jordan- from uitableviewcell detailtextlabel not showing indexPath: Single-click ViewController.swift and to enable detail text label Example code for Table View in Swift. GitHub Gist: instantly share code, notes, and snippets.

Why is my UITableViewCell not showing detailTextLabel in ANY , This one has me pulling my hair out. I'm just trying to create a table with the UITableViewCellStyleSubtitle style, with text and detail. But the  The UITableView supports virtualization of its cell controls so in order to get the cell you need to call the DequeueReusableCellmethod on the table view. In versions earlier than iOS 6 this will return null if the cell hasn’t been created yet.

  • Right! Thank you. I had tried to change the style to Subtitle but I changed UITableViewStyle instead of UITableViewCellStyle and that didn't compile so I thought the Subtitle style was no longer available.
  • Haha! We all make silly mistakes when coding. I think if Apple disabled the subtitle style, there would be riots.
  • This seems like it will initialized a new UITableViewCell every time, rather than dequeuing from the stack to preserve memory. It seems like the only way to reuse cells of style UITableViewCellStyleSubtitle would be to subclass, override the initializer, and call the usual [tableView dequeueReusableCellWithIdentifier:@"ReuseIdentifier"]; Can anyone confirm or deny this? See discussion on initWithStyle:reuseIdentifier:…:
  • Just in case anyone wants the Swift 4 version of @AurumAquila's answer: let cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "cell")
  • Right! Thank you. See my comment to the prior answer.
  • I wish I could give you +100 What a simple answer. Lots of complicated answeres around this. But this answer is obviously the way to go for swift4 ! Thank you !!!!
  • How do you register a cell of type subtitle programmatically without using a storyboard?