Git Product home page Git Product logo

kkinitializer's Introduction

KKInitializer

常用UI控件的便利构造方法集合 现支持 UILabel/UIButton/UIImage/UITextField/UITextView/UIColor等

代码示例

    UILabel *label =  [UILabel k_labelWithText:@"Label构造器" boldFontSize:15 textColor:UIColor.redColor];
    label.k_cornerRadius(5).k_backgroudColor(UIColor.lightGrayColor).k_frame(CGRectMake(100, 100, 100, 40));
    [self.view addSubview:label];
    UIButton *btn = [UIButton k_btnForCustomTypeWithTitle:@"Button构造器" titleColor:[UIColor whiteColor] fontSize:20];
    btn.k_bgImgColor([UIColor purpleColor]).k_cornerRadius(5.0f);
    [self.view addSubview:btn.k_frame(CGRectMake(100, 200, 150, 40))];
    UIImage *img = UIImage.k_imgFillColor(UIColor.redColor, CGSizeMake(100, 100)).k_cornerRadius(5.0f);
    UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
    imgView.frame = CGRectMake(100, 400, 100, 100);
    [self.view addSubview:imgView];
    UITextField *textField = UITextField.k_initFrame(CGRectMake(100, 100, 200, 40));
    textField.k_placeholder(@"占位占位占位").k_borderStyle(UITextBorderStyleRoundedRect).k_textColor(UIColor.redColor).k_fontSize(20.f);
    [self.view addSubview:textField];
    UITextView *textView = UITextView.k_init().k_textColor(UIColor.redColor).k_boldFontSize(15.f);
    [self.view addSubview:textView];
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    view.backgroundColor = UIColor.k_hexColor(0xFF3300);
    view.backgroundColor = UIColor.k_RGBColor(255,121,0);
    view.backgroundColor = UIColor.k_randomColor();
    [self.view addSubview:view];

Cocoapods

全部控件构造方法扩展(推荐):

pod 'KKInitializer'

需要其中1个或多个 ,选择使用:

pod 'KKInitializer/UILabel+KKInitializer'
pod 'KKInitializer/UIButton+KKInitializer'
pod 'KKInitializer/UIImage+KKInitializer'
pod 'KKInitializer/UITextField+KKInitializer'
pod 'KKInitializer/UITextView+KKInitializer'
pod 'KKInitializer/UIColor+KKInitializer'

blog

简书:https://www.jianshu.com/p/e6ef1df5dd9a

kkinitializer's People

Contributors

cocoz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

kkinitializer's Issues

UIColor

缺少全局 lineColor
缺少全局 backgroundColor TableViewBackgroundColor
缺少全局 mainColor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.