Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

colaicode/CLKit

Open more actions menu

Repository files navigation

CLKit

封装常用的控件

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'

About

封装常用的控件

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.