可以给Label添加内边距,支持xib可视化修改,支持autolayout/masonry约束
简书:https://www.jianshu.com/p/57776de0a507
KKPaddingLabel *paddingLabel = [[KKPaddingLabel alloc] initWithFrame:CGRectZero];
paddingLabel.text = @"KKPaddingLabel";
paddingLabel.backgroundColor = [UIColor lightGrayColor];
paddingLabel.padding = UIEdgeInsetsMake(10, 10, 10, 10);
paddingLabel.cornerRadius = 5.0f;
paddingLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:paddingLabel];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:paddingLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:200.0f]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:paddingLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:100.0f]];
pod 'KKPaddingLabel'