How to add padding-left on a UILabel created programmatically?

前端 未结 8 1106
温柔的废话
温柔的废话 2020-12-29 06:33

I know this is a noob question but ...I have these labels on a tableview, but the text is completely squished to the left. I want to add a bit of padding. How do I go about

8条回答
  •  情书的邮戳
    2020-12-29 06:51

    True, it's a bit inexact and hackish, but you could always add a space in front of the month name like this:

    headerLabel.text = [NSString stringWithFormat:@" %@",
                        [[_months objectAtIndex:section] objectForKey:@"name"]];
    

提交回复
热议问题