Text not wrapping in a label in MobileTableCustomCell

In a otherwise working iosApp which I created in 2022, we have only now noticed, that long text is not wrapping. We use a MobileLabel within a MobileTableCustonCell and LineBreakMode is set to WordWrap, but longer text is not wrapping withing the label.

Also, if I try apply the LineBreakMode in code, this is not showing any effect either.

Public Sub LoadText()
// Add name or organization name as section title
Me.TableAdressDetails.AddSection(“”)

// define variables
Var cellData As MobileTableCellData
Var customCell As NWSCustomCell

cellData = TableAdressDetails.CreateCustomCell(GetTypeInfo(NWSCustomCell))
customCell = NWSCustomCell(cellData.Control)
cellAddConstraint(customCell)
customCell.cellText.Text = detail

'customCell.cellText.LineBreakMode = MobileLabel.LineBreakModes.CharacterWrap
'customCell.Refresh

TableAdressDetails.AddRow(0, cellData)

End Sub

Is this a bug in the old version of 2022.1 or am I getting it all wrong?

See Screenshot and sample project



test.xojo_binary_project.zip (233.3 KB)

Ok, so you have two problems here…

  1. Your left and right constraints should be set to “required” or “highest”. Otherwise auto layout will break a constraint to satisfy the layout.

  2. You need to set a bottom constraint to effectively “push” the bottom of the cell downward. Again with top and bottom set to “required” or “highest”

1 Like

With left and right constraints priority set to “Medium”, the auto-layout engine is creating a label that takes all available width, in this case, the label was several thousand pixels wide to fit all text in one line.

After setting all three constraints to “Highest”, the text does wrap correctly. It even seems that setting a bottom constraint isn’t necessary.

1 Like

Thank you, Jeremy and Greg, for looking into this! This is big help to me! Thanks and best wishes! Oliver

Yeah I remember doing some magic to get intrinsic label heights to work properly in this context, but I no longer know the details.

1 Like