CaamDauExtensionObjC 1.0

CaamDauExtensionObjC 1.0

lcd 维护。



  • liucaide

CaamDauObjC (Swift 版本在这里

CI Status Version License Platform

目前更多关注于 Swift 版本,OC 版本剩余组件暂不整理更新

pod 'CaamDauExtensionObjC'

CaauDau核心组件

Form流式模型化排版组件

  • 将 delegate、dataSource 设置为 CD_FormTableViewDelegateDataSource
  • 当然也可以设置为 self,只需将 CD_FormTableViewDelegateDataSource 内的方法完全复制过来,而不需要做任何修改
- (VM_TableViewForm *)vm {
    if (!_vm) {
        _vm = [VM_TableViewForm new];
    }
    return _vm;
}
- (void)viewDidLoad {
    [super viewDidLoad];

    self.delegateData = [[CD_FormTableViewDelegateDataSource alloc] initWithForm:self.vm];
    self.tableView.delegate = self.delegateData;
    self.tableView.dataSource = self.delegateData;
    [self.delegateData makeTableView:self.tableView];
    
    __weak typeof(self) weakSelf = self;
    [self.tableView cd_headerAddMJRefresh:^{
        __strong typeof(weakSelf) strongSelf = weakSelf;
        [strongSelf.vm requestData:YES];
        [strongSelf.tableView cd_endRefreshing];
    }];
    [self.tableView cd_beginRefreshing];
}
  • 构建单元格模型:将多点关系的 delegate dataSource 现在转化为单点关系的模型单元
    {// 将多点关系的 delegate dataSource 现在转化为单点关系的 模型单元
        CD_Row *row = [CD_Row rowWithViewClass:[Cell_TableViewXib class] then:^(CD_Row * _Nonnull obj) {
            obj.viewData = @"Cell_TableViewXib";
            obj.config = [UIColor orangeColor];
            obj.height = 60;
            obj.bundleFrom = @"Home";
        }];
        row.callback = ^(id  _Nonnull any) {
            NSLog(@"点击了 %@ Button", any);
        };
        [f addObject:row];
    }
    [self.forms addObject:f];
    
    if (self.reloadData) {
        self.reloadData();
    }

Chain链式调用组件

UIAlertController.cd_alert
    .cd_title(@"提示")
    .cd_actionCustom(^(UIAlertAction * a){
        a.cd_text(@"以后再说").cd_textColor(color_Txt_3());
    })
    .cd_actionCustom(^(UIAlertAction * a){
        a.cd_text(@"给个好评")
         .cd_textColor(color_Main_1())
         .cd_handler(^(UIAlertAction * b){
            .....
        });
    })
    .cd_show();

类别便利性扩展

作者

许可协议

CaamDauObjC 在MIT许可下可用。有关更多信息,请参阅LICENSE文件。