TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2016 |
Maintained by spirit-jsb.
JSUIKit: 常用控件的工厂类
pod 'JSUIKit', '~> 1.2.1'
#import "JSUIKit.h"
/**
创建一个UILabel:背景颜色、富文本、文字对齐方式、显示行数
@param backgroundColor 背景颜色
@param attributedText 富文本
@param textAlignment 文字对齐方式
@param numberOfLines 显示行数
@param lineBreakMode 字符截断类型
*/
+ (UILabel *)createLabelWithBackgroundColor:(UIColor *)backgroundColor
attributedText:(nullable NSAttributedString *)attributedText
textAlignment:(NSTextAlignment)textAlignment
numberOfLines:(NSInteger)numberOfLines
lineBreakMode:(NSLineBreakMode)lineBreakMode;
/**
创建一个UILabel:背景颜色、文字、文字颜色、文字对齐方式、文字字体大小、显示行数
@param backgroundColor 背景颜色
@param text 文字
@param fontSize 文字字体大小
@param textColor 文字颜色
@param textAlignment 文字对齐方式
@param numberOfLines 显示行数
@param lineBreakMode 字符截断类型
*/
+ (UILabel *)createLabelWithBackgroundColor:(UIColor *)backgroundColor
text:(nullable NSString *)text
fontSize:(CGFloat)fontSize
textColor:(nullable UIColor *)textColor
textAlignment:(NSTextAlignment)textAlignment
numberOfLines:(NSInteger)numberOfLines
lineBreakMode:(NSLineBreakMode)lineBreakMode;
/**
创建一个UIImageView:背景颜色、图片名称、contentMode、交互性
@param backgroundColor 背景颜色
@param imageName 图片名称
@param contentMode contentMode
@param isUserInteractionEnabled 交互性
*/
+ (UIImageView *)createImageViewWithBackgroundColor:(UIColor *)backgroundColor
imageName:(nullable NSString *)imageName
contentMode:(UIViewContentMode)contentMode
userInteractionEnabled:(BOOL)isUserInteractionEnabled;
/**
创建一个UIButton:背景颜色、背景图片、富文本
@param backgroundColor 背景颜色
@param backgroundNormalImageName 正常状态下的背景图片
@param backgroundSelectedImageName 选中状态下的背景图片
@param normalAttributedTitle 正常状态下的富文本
@param selectedAttributedTitle 选中状态下的富文本
*/
+ (UIButton *)createButtonWithBackgroundColor:(UIColor *)backgroundColor
backgroundNormalImageName:(nullable NSString *)backgroundNormalImageName
backgroundSelectedImageName:(nullable NSString *)backgroundSelectedImageName
normalAttributedTitle:(nullable NSAttributedString *)normalAttributedTitle
selectedAttributedTitle:(nullable NSAttributedString *)selectedAttributedTitle;
/**
创建一个UIButton:背景颜色、背景图片、文字、文字颜色、文字字体大小
@param backgroundColor 背景颜色
@param backgroundNormalImageName 正常状态下的背景图片
@param backgroundSelectedImageName 选中状态下的背景图片
@param normalTitle 正常状态下的文字
@param selectedTitle 选中状态下的文字
@param normalTitleColor 正常状态下的文字颜色
@param selectedTitleColor 选中状态下的文字颜色
@param titleFontSize 文字字体大小
*/
+ (UIButton *)createButtonWithBackgroundColor:(UIColor *)backgroundColor
backgroundNormalImageName:(nullable NSString *)backgroundNormalImageName
backgroundSelectedImageName:(nullable NSString *)backgroundSelectedImageName
normalTitle:(nullable NSString *)normalTitle
selectedTitle:(nullable NSString *)selectedTitle
normalTitleColor:(nullable UIColor *)normalTitleColor
selectedTitleColor:(nullable UIColor *)selectedTitleColor
titleFontSize:(CGFloat)titleFontSize;
/**
创建一个UIButton:背景颜色、图片、富文本
@param backgroundColor 背景颜色
@param normalImageName 正常状态下的图片
@param selectedImageName 选中状态下的图片
@param normalAttributedTitle 正常状态下的富文本
@param selectedAttributedTitle 选中状态下的富文本
*/
+ (UIButton *)createButtonWithBackgroundColor:(UIColor *)backgroundColor
normalImageName:(nullable NSString *)normalImageName
selectedImageName:(nullable NSString *)selectedImageName
normalAttributedTitle:(nullable NSAttributedString *)normalAttributedTitle
selectedAttributedTitle:(nullable NSAttributedString *)selectedAttributedTitle;
/**
创建一个UIButton:背景颜色、图片、文字、文字颜色、文字字体大小
@param backgroundColor 背景颜色
@param normalImageName 正常状态下的图片
@param selectedImageName 选中状态下的图片
@param normalTitle 正常状态下的文字
@param selectedTitle 选中状态下的文字
@param normalTitleColor 正常状态下的文字颜色
@param selectedTitleColor 选中状态下的文字颜色
@param titleFontSize 文字字体大小
*/
+ (UIButton *)createButtonWithBackgroundColor:(UIColor *)backgroundColor
normalImageName:(nullable NSString *)normalImageName
selectedImageName:(nullable NSString *)selectedImageName
normalTitle:(nullable NSString *)normalTitle
selectedTitle:(nullable NSString *)selectedTitle
normalTitleColor:(nullable UIColor *)normalTitleColor
selectedTitleColor:(nullable UIColor *)selectedTitleColor
titleFontSize:(CGFloat)titleFontSize;
/**
创建一个UITextField:
@param backgroundColor 背景颜色
@param borderStyle 边框样式
@param backgroundImageName 背景图片:仅UITextBorderStyleNone时有效
@param fontSize 文字字体大小
@param textColor 文字颜色
@param textAlignment 文字对齐方式
@param attributedPlaceholder placeholder富文本
@param isSecureTextEntry 是否密文输入
@param isClearsOnBeginEditing 是否再次编辑清空:与isSecureTextEntry冲突,当isSecureTextEntry = YES时,默认清空
@param keyboardType 键盘样式
@param returnKeyType return键样式
@param autocorrectionType 是否使用iPhone的自动更正功能
@param autocapitalizationType 首字母是否大写
@param leftViewMode LeftView展示样式
@param rightViewMode RightView展示样式
@param clearButtonMode 设置一键清除按钮是否出现
@param leftView LeftView
@param rightView RightView
*/
+ (UITextField *)createTextFieldWithBackgroundColor:(UIColor *)backgroundColor
borderStyle:(UITextBorderStyle)borderStyle
backgroundImageName:(nullable NSString *)backgroundImageName
fontSize:(CGFloat)fontSize
textColor:(nullable UIColor *)textColor
textAlignment:(NSTextAlignment)textAlignment
attributedPlaceholder:(nullable NSAttributedString *)attributedPlaceholder
secureTextEntry:(BOOL)isSecureTextEntry
clearsOnBeginEditing:(BOOL)isClearsOnBeginEditing
keyboardType:(UIKeyboardType)keyboardType
returnKeyType:(UIReturnKeyType)returnKeyType
autocorrectionType:(UITextAutocorrectionType)autocorrectionType
autocapitalizationType:(UITextAutocapitalizationType)autocapitalizationType
leftViewMode:(UITextFieldViewMode)leftViewMode
rightViewMode:(UITextFieldViewMode)rightViewMode
clearButtonMode:(UITextFieldViewMode)clearButtonMode
leftView:(nullable UIView *)leftView
rightView:(nullable UIView *)rightView;
/**
创建一个UITextView:
@param backgroundColor 背景颜色
@param fontSize 文字字体大小
@param textColor 文字颜色
@param textAlignment 文字对齐方式
@param attributedPlaceholder placeholder富文本
@param isScrollEnabled 当文字超过视图的边框时是否允许滑动
@param keyboardType 键盘样式
@param returnKeyType return键样式
@param dataDetectorTypes 显示数据类型的连接模式(如电话号码、网址、地址等)
*/
+ (UITextView *)createTextViewWithBackgroundColor:(UIColor *)backgroundColor
fontSize:(CGFloat)fontSize
textColor:(nullable UIColor *)textColor
textAlignment:(NSTextAlignment)textAlignment
attributedPlaceholder:(nullable NSAttributedString *)attributedPlaceholder
scrollEnabled:(BOOL)isScrollEnabled
keyboardType:(UIKeyboardType)keyboardType
returnKeyType:(UIReturnKeyType)returnKeyType
dataDetectorTypes:(UIDataDetectorTypes)dataDetectorTypes;
spirit-jsb, [email protected]
JSUIKit 遵循 MIT 开源许可证, 详情请查看 LICENSE 文件