Latest 1.1.9
Homepage https://github.com/colaicode/CLKit
License MIT
Platforms ios 7.0, requires ARC
Dependencies Masonry
Authors

封装常用的控件

KKBaseButton

提供链式语法设置button属性。
demo1:

KKBaseButton* sender = [KKBaseButton buttonWithDefaultFont:@"Button"].normalTitleColor([UIColor blueColor]).normalImage(@"home_up").buttonFrame(CGRectMake(100, 100, 100, 40)).selectImage(@"home_down");
[sender upInsideAction:^(KKBaseButton* sender){
    sender.selected = !sender.selected;
}];
[self.view addSubview:sender];

demo2:

KKBaseButton* button = [KKBaseButton buttonWithImage:@"home_up" actionBlock:^(KKBaseButton* sender){
        sender.selected = !sender.selected;
}].buttonFrame(CGRectMake(100, 200, 100, 40)).selectImage(@"home_down");
[self.view addSubview:button];

KKBaseLabel

demo:

KKBaseLabel* label = [KKBaseLabel subheadlineLable]
                         .labelTextColor([UIColor redColor])
                         .labelAlignment(NSTextAlignmentLeft)
                         .labelFrame(CGRectMake(100, 100, 100, 40))
                         .labelBgColor([UIColor darkTextColor])
                         .labelText(@"text");
[self.view addSubview:label];

KKBaseTextField

提供链式语法设置textfield的属性。
demo1: 设置基本属性

KKBaseTextField* tf = [KKBaseTextField textFieldWithPlaceholder:@"请输入用户名"].tfTitleLeftView(@"用户名",CGSizeMake(60, 40),10);
[self.view addSubview:tf];

demo2: 创建toolbar以及设置最大输入长度和每4个字符插入空格

KKBaseTextField* tf4 =
[KKBaseTextField textFieldWithPlaceholder:@"请输入手机号"]
.tfImageLeftView(@"phone",CGSizeMake(40, 40))
.tfCreateToolbar()
.tfTextEdgeInsets(UIEdgeInsetsMake(0, 5, 0, 5))
.tfTextMaxLength(11)
.tfTextAutoSegment();
[self.view addSubview:tf4];

demo3:设置inputView为UIPickerView

KKBaseTextField* tf5 =
[KKBaseTextField textFieldWithPlaceholder:@"请选择地址"]
.tfImageLeftView(@"address",CGSizeMake(40, 40))
.tfCreatePickerView()
.tfImageRightView(@"arrow_right",CGSizeMake(40, 40));
tf5.baseTextFieldDelegate = self;
tf5.baseTextFieldDataSource = self;
[self.view addSubview:tf5];

KKBaseAlertView

demo:

[KKBaseAlertView showAlert:@"alert" complete:^(NSInteger buttonIndex){
        NSLog(@"%ld",(long)buttonIndex);
}];

KKBaseActionSheet

demo:

[KKBaseActionSheet showActionSheet:@"请选择性别" buttons:@[@"男",@"女"] complete:^(NSInteger buttonIndex){
        NSLog(@"%ld",(long)buttonIndex);
}];

安装

pod ‘CLKit’

Latest podspec

{
    "name": "CLKit",
    "version": "1.1.9",
    "summary": "u4e00u4e9bu5e38u7528u63a7u4ef6u5c01u88c5",
    "description": "u5c01u88c5u4e86u5e38u7528u7684u63a7u4ef6uff0cu5982buttonu3001labelu3001textfieldu3001alertViewu3001actionSheetu7b49,u63d0u4f9bu94feu5f0fu8bedu6cd5",
    "homepage": "https://github.com/colaicode/CLKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "colaicode": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/colaicode/CLKit.git",
        "tag": "1.1.9"
    },
    "source_files": "CLKitDemo/KKKit/KKKit.h",
    "public_header_files": "CLKitDemo/KKKit/KKKit.h",
    "resources": "CLKitDemo/KKKit/KKKit.bundle",
    "requires_arc": true,
    "dependencies": {
        "Masonry": []
    },
    "subspecs": [
        {
            "name": "KKBaseButton",
            "source_files": "CLKitDemo/KKKit/KKBaseButton/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseButton/KKBaseButton.h"
        },
        {
            "name": "KKBaseLabel",
            "source_files": "CLKitDemo/KKKit/KKBaseLabel/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseLabel/KKBaseLabel.h"
        },
        {
            "name": "KKBaseAlertView",
            "source_files": "CLKitDemo/KKKit/KKBaseAlertView/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseAlertView/KKBaseAlertView.h"
        },
        {
            "name": "KKBaseActionSheet",
            "source_files": "CLKitDemo/KKKit/KKBaseActionSheet/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseActionSheet/KKBaseActionSheet.h"
        },
        {
            "name": "KKBaseTextField",
            "source_files": "CLKitDemo/KKKit/KKBaseTextField/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseTextField/KKBaseTextField.h"
        },
        {
            "name": "KKBaseTableView",
            "source_files": "CLKitDemo/KKKit/KKBaseTableView/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseTableView/*.h"
        },
        {
            "name": "KKBaseViewController",
            "source_files": "CLKitDemo/KKKit/KKBaseViewController/*.{h,m}",
            "public_header_files": "CLKitDemo/KKKit/KKBaseViewController/*.h",
            "dependencies": {
                "CLKit/KKBaseLabel": [],
                "CLKit/KKBaseButton": [],
                "CLKit/KKBaseTableView": []
            }
        }
    ]
}

Pin It on Pinterest

Share This