// // GMButton.h // Gengmei // // Created by Thierry on 12/26/14. // Copyright (c) 2014 Wanmeichuangyi. All rights reserved. // #import NS_ASSUME_NONNULL_BEGIN //渐变按钮渐变方向 typedef NS_ENUM(NSUInteger, GMGradientType) { GMGradientTypeTopToBottom = 0, //从上到小 GMGradientTypeLeftToRight = 1, //从左到右 GMGradientTypeLeftUpToRightLow = 2, //左上到右下 GMGradientTypeRightUpToLeftLow = 3, //右上到左下 }; //见设计稿(UI组件化->组件_按钮.sketch) typedef NS_ENUM(NSUInteger, GMButtonType) { GMButtonTypeGreen, //绿色无边框直角矩形 GMButtonTypeGreenRoundCorner, //绿色带6px的圆角无边框矩形 GMButtonTypeGreenSemicircle, //绿色半圆无边框矩形 GMButtonTypeGreenRoundCornerBorder, //绿色、6px圆角、1px的有边框的矩形 GMButtonTypeGreenSemicircleBorder, //绿色、半圆、1px的有边框的矩形 GMButtonTypeGreenRoundCornerGradient, //绿色、6px圆角、无边框的渐变矩形 GMButtonTypeGreenSemicircleGradient, //绿色、半圆、无边框的渐变矩形 GMButtonTypeRed, //红色无边框直角矩形 GMButtonTypeRedRoundCorner, //红色带6px的圆角无边框矩形 GMButtonTypeRedSemicircle, //红色半圆无边框矩形 GMButtonTypeRedRoundCornerBorder, //红色、6px圆角、1px的有边框的的矩形 GMButtonTypeRedRoundCornerGradient, //红色、6px圆角、无边框的渐变矩形 GMButtonTypeRedSemicircleGradient, //红色、半圆、无边框的渐变矩形 GMButtonTypeGraySemicircleBorder, //灰色、半圆、1px的有边框的矩形 }; @interface GMButton : UIButton /** * @author licong, 16-12-30 17:12:55 * * 是否支持Button自适应热区,Apple人机交互指南建议,可点击控件的热区最好是44*44,默认是NO,不支持 * * @since 5.8 */ @property (nonatomic, assign) BOOL enableAdaptive; /** * @author licong, 16-12-30 17:12:31 * * 自适应热区宽,默认是 44 * * @since 5.8 */ @property (nonatomic, assign) float adaptiveHotAreaWidth; /** * @author licong, 16-12-30 17:12:09 * * 自适应热区高,默认是 44 * * @since 5.8 */ @property (nonatomic, assign) float adaptiveHotAreaHeight; /** * @author licong, 16-12-30 17:12:30 * * 初始化方法 * * @since 5.8 */ - (void)setup __attribute__((objc_requires_super)); /** * @author licong, 16-12-30 17:12:46 * * 创建一个button,并设置好它的title、backgroundColor、size、titleColor * * @param title title * @param bgColor backgroundColor * @param size 大小 * @param titleColor title标题 * * @return 返回创建好的button * * @since 5.8 */ + (instancetype)buttonWithTitle:(nullable NSString *)title backgroundColor:(nullable UIColor *)bgColor titleFontSize:(CGFloat)size titleColor:(nullable UIColor *)titleColor; /** * @author licong * * UI组件化后自定制Button * * @param customType 工厂模式下的button类型 * * @return 返回创建好的button * * @since 6.2.0 */ + (instancetype)buttonWithCustomType:(GMButtonType)customType; /** * @author licong, 16-12-30 17:12:29 * * 根据Button的状态设置对应的背景颜色 * * @param backgroundColor button的背景颜色 * @param state button的controlState * * @since 5.8 */ - (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state; @end NS_ASSUME_NONNULL_END