Skip to content

Individual table column and row padding #151

Open

Description

@jem5519

When using a table to lay out a report I would like to reduce the spacing between cell rows without effecting the spacing between cell columns. I understand that this may be achieved by changing the top and bottom padding of cells independent of the padding on the sides, but I don't see any way to do this in the current exposed commands.

Activity

  1. philprime commented on Jul 24, 2019

    @philprime
    Member

    Yes, currently there is only one padding and one margin value to set these values for all directions.

    We could add individual values per side, but these would be horizontal values per column, and vertical values per row and not for individual cells.

  2. jem5519 commented on Jul 24, 2019

    @jem5519
    Author
  3. changed the title [-]Want to be able to adjust the effective spacing between cell rows without effecting spacing between columns[/-] [+]Individual table column and row padding[/+] on May 19, 2020
  4. Vinzius commented on Apr 14, 2021

    @Vinzius

    Hello !

    Just in case it could help someone looking for a solution, I bypassed the current limitation by adding a minimum line height to an attributed string.

    Of course, it'll only work with text components, and for the vertical padding, but it's a solution in case you really need the padding ^^

    So for instance:

    let font = UIFont.boldSystemFont(ofSize: 12)
    let pStyle = NSMutableParagraphStyle()
    pStyle.minimumLineHeight = ceil(font.lineHeight * 1.7)
    
    NSAttributedString(string: "My text", attributes: [
      .font: font,
      .foregroundColor: UIColor.black,
      .paragraphStyle: pStyle
    ])

    (by the way, thanks a lot for the lib!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions