Latest 1.0.1
Homepage https://github.com/cocoZ/KKPaddingLabel
License MIT
Platforms ios 9.0, requires ARC
Authors

KKPaddingLabel

可以给Label添加内边距,支持xib可视化修改,支持autolayout/masonry约束

xib效果 动图

xib可视化编辑内边距

代码效果-灰色背景的Label(见下图), Masonry约束效果相同

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]];

Image text

Cocoapods

pod 'KKPaddingLabel'

Latest podspec

{
    "name": "KKPaddingLabel",
    "version": "1.0.1",
    "summary": "u7b80u5355u7684uff0cu53efu4ee5u7ed9Labelu6dfbu52a0u5185u8fb9u8ddduff0cu652fu6301autolayout",
    "homepage": "https://github.com/cocoZ/KKPaddingLabel",
    "license": "MIT",
    "authors": {
        "cocoa": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/cocoZ/KKPaddingLabel.git",
        "tag": "1.0.1"
    },
    "source_files": "KKPaddingLabel/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This