名称:CBUIKit
作用:快速创建常用的UI,使代码更加整洁并且提高开发效率~
作者:昶博
前言
作为一个iOS开发工程师,经常会写一些无聊的初始化方法,我觉得很浪费时间,所以就整理了一下,这个结合Masonry或者SDAutoLayout使用我觉得比较方便~
演示图
UILabel.png
UIView.png
UIButton.png
UIImageView.png
UITableView.png
UITextField.png
UITextView.png
初始化方法(这个不统一,你可以根据自己的习惯进行添加,这个是我平时使用的)
#pragma mark - For UILabel
+ (UILabel *)createLabelWithTextColor:(UIColor *)textColor
fontSize:(CGFloat)fontSize;
#pragma mark - For UIView
+ (UIView *)createViewWithBgColor:(UIColor *)bgColor;
+ (UIView *)createViewWithBgColor:(UIColor *)bgColor
cornerRadius:(CGFloat)cornerRadius;
#pragma mark - For UIButton
+ (UIButton *)createButtonWithTitle:(NSString *)title
fontSize:(CGFloat)fontSize
titleColor:(UIColor *)titleColor;
+ (UIButton *)createButtonWithTitle:(NSString *)title
fontSize:(CGFloat)fontSize
titleColor:(UIColor *)titleColor
cornerRadius:(CGFloat)cornerRadius;
#pragma mark - For UIImageView
+ (UIImageView *)createImageView;
+ (UIImageView *)createImageViewWithCornerRadius:(CGFloat)cornerRadius;
#pragma mark - For UITableView
+ (UITableView *)createTableViewWithStyle:(UITableViewStyle)style
separatorStyle:(CGFloat)separatorStyle;
#pragma mark - For UITextField
+ (UITextField *)createTextFieldWithPlaceholder:(NSString *)placeholder
textColor:(UIColor *)textColor;
#pragma mark - For UITextView
+ (UITextView *)createTextViewWithTextColor:(UIColor *)textColor
fontSize:(CGFloat)fontSize;
慢慢的在整理项目中的一些基础代码,优化写法,算是一个小总结吧~