Latest 0.0.5
Homepage https://github.com/liucaide/BoxObjC_Chain
License MIT
Platforms ios 8.0
Authors

Object-C 链式调用扩展,(尚在整理中,持续更新)

CI Status
Version
License
Platform

CocoaPods

pod 'BoxObjC_Chain'

Usage

Before

- (UIButton *)button{
    if (!_button) {
        _button = [UIButton new];
        [_button setTitle:@"Button" forState:UIControlStateNormal];
        [_button setTintColor:[UIColor yellowColor]];
        _button.backgroundColor = [UIColor redColor];
        _button.frame = CGRectMake(60, 100, 50, 50);
        _button.layer.cornerRadius = 8;
        _button.clipsToBounds = YES;
        _button.layer.borderWidth = 2;
        _button.layer.borderColor = [UIColor yellowColor].CGColor;
    }
    return _button;
}

Now

- (UIButton *)b_btn1{
    if (!_b_btn1) {
        _b_btn1 = [UIButton b_init];
        _b_btn1
        .b_title(@"1")
        .b_titleColor([UIColor yellowColor])
        .b_bgColor([UIColor redColor])
        .b_frame(CGRectMake(60, 100, 50, 50))
        .b_radius_clips(8, YES)
        .b_borderWidth(2)
        .b_borderColor([UIColor yellowColor]);
    }
    return _b_btn1;
}
- (void)clickBtn1:(UIButton*)b{
    b.b_loading([UIColor whiteColor], 2);

    __weak typeof(self) weakSelf = self;
    /// ---------- alert
    UIAlertController.b_alert
    .b_title(@"提示")
    .b_titleFont([UIFont systemFontOfSize:16])
    .b_titleColor([UIColor grayColor])
    .b_message(@"123456")
    .b_messageFont([UIFont systemFontOfSize:16])
    .b_messageColor([UIColor blackColor])
    .b_actionCustom(^(UIAlertAction * a){
        a.b_textColor([UIColor redColor]);
        a.b_text(@"点我呀");
        a.b_style(UIAlertActionStyleCancel);
        a.b_handler(^(UIAlertAction * a){
            __strong typeof(weakSelf) strongSelf = weakSelf;
            strongSelf.b_btn1.b_loadingHidden();
            NSLog(@"点击了 点我呀");

        });
    })
    .b_actionHandler(^(UIAlertAction * b){
        __strong typeof(weakSelf) strongSelf = weakSelf;
        strongSelf.b_btn1.b_loadingHidden();
        NSLog(@"点击了 啥都没有");
    })
    .b_action(@"去去去")
    .b_show(self);
}

Author

liucaide, [email protected]

License

BoxObjC_Chain is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BoxObjC_Chain",
    "version": "0.0.5",
    "summary": "BoxObjC_Chain is Object-C Cocoa chain call extension.",
    "description": "BoxObjC_Chain is Object-C Cocoa chain call extension, you can call the API gracefully.",
    "homepage": "https://github.com/liucaide/BoxObjC_Chain",
    "license": "MIT",
    "authors": {
        "LCD": "https://github.com/liucaide"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/liucaide/BoxObjC_Chain"
    },
    "source_files": [
        "BoxObjC_Chain",
        "BoxObjC_Chain/**/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This