UILabel Align text vertically in Collectionview


I need to align the text inside a TTMSFMXNativeUICollectionViewTemplateLabel vertically to the top of the label so all labels show their text at the same vertical position.

The text is assigned dynamically:

procedure TFOrders.DetailCollectionApplyItemValue(Sender: TObject; AControl: TTMSFMXNativeUICollectionViewTemplateControl; ASection, ARow: Integer);
  if isLabel(AControl) then begin
    if AControl.Tag = 201 then
      AsLabel(AControl).Text := '47/2345';
    if AControl.Tag = 202 then begin
      AsLabel(AControl).Text := 'This is a long Text which should be aligned vertically to the top of the label';

The properties of the Label are:

object DetailCollectionLabel02: TTMSFMXNativeUICollectionViewTemplateLabel
  Tag = 202
  ContentMode = cmViewContentModeRedraw
  X = 162.000000000000000000
  Width = 200.000000000000000000
  Height = 17.500000000000000000
  Font.Size = 14.000000000000000000
  NumberOfLines = 0
  TemplateKind = 0

I am not sure if sizeToFit the right way to do it. When scrolling.

What happens is that sometimes the label is totally messed up or the text is missing.  Instead of showing 4 lines it is printed over one line over all other objects.

See attached screenshots.

I think this happens when the label is not visible when the text is assigned.

Thanks for help,

It's unclear exactly what happens, but I suggest to perhaps use the Alignment property instead?