StreamKit 2.4.3

StreamKit 2.4.3

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
Released最后发布2019年12月

GodL 维护。



StreamKit 2.4.3

  • GodL

StreamKit

============

License MIT  CocoaPods  CocoaPods  Support 

适用于 iOS 的链式编程框架。

安装

CocoaPods

  1. pod 'StreamKit' 添加到您的 Podfile 中。
  2. 运行 pod installpod update
  3. 导入 <StreamKit/StreamKit.h>。

使用方法

基本用法

//(Create a UILabel)
UILabel* label = [UILabel new];//UILabel.new
label.sk_frame(CGRectZero)
.sk_fontSize(15)
.sk_textAlignment(NSTextAlignmentCenter)
.sk_textColor([UIColor redColor])
.sk_text(@"a label")
.sk_addSimpleClickAction(^{
    //click action
});
[self.view addSubview:label];


//event block(create a button)
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.sk_frame(CGRectMake(100, 100, 100, 100))
.sk_setTitleNormal(@"a button")
.sk_setTitleColorNormal([UIColor redColor])
.sk_setFontSize(15)
.sk_addEventBlock(UIControlEventTouchDown,^(UIButton* button){

})
.sk_addEventBlock(UIControlEventTouchUpInside,^(UIButton* button){

})
.sk_addEventBlock(UIControlEventTouchUpOutside,^(UIButton* button){

});
[self.view addSubview:button];



//delegate block(create a textField)
UITextField* textField = UITextField.sk_init(CGRectZero)
.sk_textColor([UIColor blackColor])
.sk_fontSize(15)
.sk_placeholder(@"begin")
.sk_addEventBlock(UIControlEventEditingChanged,^(UITextField* textField){

})
.sk_textFieldShouldReturn(^BOOL(UITextField* textField){
    return YES;
})
.sk_textFieldShouldBeginEditing(^BOOL(UITextField* textField){
    return YES;
})
.sk_textFieldShouldChangeCharactersInRange(^BOOL(UITextField* textField,NSRange range,NSString* string){
    return YES;
});
[self.view addSubview:textField];


//KVO
label.sk_addObserverWithKeyPath(@"text",^(NSDictionary* change){

});


//NSNotification
NSNotificationCenter* defaultNotification = [NSNotificationCenter defaultCenter];
defaultNotification.sk_addNotification(UITextFieldTextDidChangeNotification,^(NSNotification* noti){

})
.sk_addNotification(UITextFieldTextDidEndEditingNotification,^(NSNotification* noti){

});

许可协议

StreamKit 基于 MIT 许可协议提供。详细信息请参阅 LICENSE 文件。