Latest 1.0.0
Homepage https://github.com/rayonchen/CreatView
License MIT
Platforms ios 8.0, requires ARC
Authors

Programing_CreatView

函数式编程、链式编程、面向接口编程结合使用,自定义创建控件方法,工程不使用xib、storyboard,创建控件是一个很低效率且没啥技术含量的事情,此方法可以有效降低工作时间,为控件添加一些复杂属性也极为方便,也处理了控件渲染的问题,同时工程布局更加清晰

使用

Pod

pod ‘CreatView’, ‘~> 1.0.0’

下载文件

  • 下载demo,将CreatControls文件夹放入到自己工程中
  • 导入CreatControls.h文件,使用[CreatControls creatControls:<#^(CreatControls *controls)block#>]方法,在block内部,controls后面只能用View类型,后面根据自己的需求添加属性,
  • 非block属性不放在末尾,否则爆黄;中文部分的属性最好放最后,出现中文后面属性不能智能拼写,栗子:

    UIFont *font1 = [UIFont systemFontOfSize:14.0f];
    UIColor *textColor = [UIColor whiteColor];
    UIColor *backColor = [UIColor cyanColor];
    CGRect frame1 = CGRectMake(100, 100, 100, 30);
    
    UIView *view = [CreatControls creatControls:^(CreatControls<CreatControlsProtocol> *controls) {
        controls.label.backColor(backColor).rect(frame1).middle_alignment.titleColor(textColor).setFont(font1).title(@"测试");
    }];
    [self.view addSubview:view];

推荐一篇好文 @jieme
这篇demo基本可以与文章对照一起看,有任何意见建议的同学请Issues我,如果觉得不错请点赞哟

Latest podspec

{
    "name": "CreatView",
    "version": "1.0.0",
    "summary": "u94feu5f0fu7f16u7a0bu4e00u884cu4ee3u7801u521bu5efau57fau7840u63a7u4ef6",
    "description": "u51fdu6570u5f0fu7f16u7a0bu3001u94feu5f0fu7f16u7a0bu3001u9762u5411u63a5u53e3u7f16u7a0bu7ed3u5408u4f7fu7528uff0cu81eau5b9au4e49u521bu5efau63a7u4ef6u65b9u6cd5uff0cu5de5u7a0bu4e0du4f7fu7528xibu3001storyboarduff0cu521bu5efau63a7u4ef6u662fu4e00u4e2au5f88u4f4eu6548u7387u4e14u6ca1u5565u6280u672fu542bu91cfu7684u4e8bu60c5uff0cu6b64u65b9u6cd5u53efu4ee5u6709u6548u964du4f4eu5de5u4f5cu65f6u95f4uff0cu4e3au63a7u4ef6u6dfbu52a0u4e00u4e9bu590du6742u5c5eu6027u4e5fu6781u4e3au65b9u4fbfuff0cu4e5fu5904u7406u4e86u63a7u4ef6u6e32u67d3u7684u95eeu9898uff0cu540cu65f6u5de5u7a0bu5e03u5c40u66f4u52a0u6e05u6670",
    "homepage": "https://github.com/rayonchen/CreatView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "chenglei": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/rayonchen/CreatView.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "u7f16u7a0bu6d4bu8bd5_demo/CreatControls",
        "*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This