给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构

pod 'EDWButtonImageTitleChange'

typedef NS_ENUM (NSInteger,EDWButttonType) {
    EDWButttonTypeImageUp,
    EDWButttonTypeImageLeft,
    EDWButttonTypeImageDown,
    EDWButttonTypeImageRight,
} ;
UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];
    [btn setBackgroundColor:[UIColor cyanColor]];
    [btn setTitle:@"title!!!!" forState:UIControlStateNormal];
    [btn setFrame:CGRectMake(0, 0, 250, 200)];
    [btn setCenter:self.view.center];
    [btn setImage:[UIImage imageNamed:@"pic"] forState:UIControlStateNormal];
    [self.view addSubview:btn];
    [btn changeWithType:EDWButttonTypeImageRight andInterval:10];
EDWButttonTypeImageUp
给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构_第1张图片
up.png
EDWButttonTypeImageLeft
给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构_第2张图片
left.png
EDWButttonTypeImageDown
给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构_第3张图片
down.png
EDWButttonTypeImageRight
给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构_第4张图片
right.png

https://github.com/jinjinEdward/EDWButtonImageTitleChange

你可能感兴趣的:(给UIButton添加一个枚举类型,快速切换图片和标题的上下左右排布结构)