Tableview alignment not working

In the Tableview I cannot get the alignment to work

  with TableView1.Columns.Add do begin
    Header := 'Date';
    ReadOnly := True;
    Alignment := TTextAlign.taCenter;


The Alignment property is used for the column values, not for the column header. You can access the native column with the following code, and set the alignment there:


Values for alignment are:

Which unit do I need to include to use TNSTableHeaderCell?

The unit iOSApi.UIKit should be the unit which declares the NSTableHeaderCell

This is a Mac app not an iOS app.  Delphi doesn't recognize that unit.

the MacApi.AppKit unit.

It got this to work in the form create but I had to put it after the TableView1.EndUpdate or the program crashes:


I also have to put the code in the GetAlignment event.

I cannot get the regular cells to align though.  How should I do that?

Normally this should be done with the Alignment property for each column as shown in your first post.

Are you experiencing difficulties with this?

Kind Regards, 

I figured I'd use this old post.  How can I set the alignment of a checkbox in a cell?  The checkbox shows up when I use Values.Add.BooleanValue := True;



We have investigated this here and have applied a content alignment property at column level and the appriopriate event for further customization. The next version will allow you to set checkboxes centered with the columns CellContentAlignment property.