CLKit 1.1.9

CLKit 1.1.9

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2017年7月

colaicode 维护。



CLKit 1.1.9

  • colaicode

封装常用控件

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'