Multi-line UITableViewCell using UITableViewCellStyleValue2 style

20,843

It sounds to me like you'll have to create a custom UITableCell. The only way to ensure the text lines up is to get the margin/text width values correct, which can be done via trial and error, or using a measuring tool such as xScope.

Share:
20,843
petert
Author by

petert

Mac and iOS software developer.

Updated on October 12, 2020

Comments

  • petert
    petert over 3 years

    I'm trying to figure out how to replicate the UITableViewCellStyleValue2 style so that the detail text can be multiple lines - as seen in the 'address' cells in the Contacts app. Like the Contacts app, some of the fields (like street name) are optional; so it would show say 3 lines instead of 4, if the street was not nil.

    I'm I missing a trick, or do I have to create a custom cell in IB? How to ensure the text and detail text labels line-up with other UITableViewCellStyleValue2 cells?

    Thanks for any tips.