//
//  UIButton+TitleAndImageLayout.h
//  PNCMobileBank
//
//  Created by Apple on 9/3/18.
//  Copyright © 2018年 MacBook-陶(tzw). All rights reserved.
//

#import <UIKit/UIKit.h>
#import <objc/runtime.h>

typedef void(^ActionBlock)(void);

typedef NS_ENUM(NSUInteger, MKButtonEdgeInsetsStyle) {
    MKButtonEdgeInsetsStyleTop    = 0, // image在上，label在下
    MKButtonEdgeInsetsStyleLeft   = 1, // image在左，label在右
    MKButtonEdgeInsetsStyleBottom = 2, // image在下，label在上
    MKButtonEdgeInsetsStyleRight  = 3 // image在右，label在左
};
///在XIB中使用
IB_DESIGNABLE

@interface UIButton (TitleAndImageLayout)

/**
 *  设置button的titleLabel和imageView的布局样式，及间距
 *
 *  @param style titleLabel和imageView的布局样式
 *  @param space titleLabel和imageView的间距
 */
- (void)layoutButtonWithEdgeInsetsStyle:(MKButtonEdgeInsetsStyle)style
                        imageTitleSpace:(CGFloat)space;


@property (nonatomic, assign)IBInspectable CGFloat space;

@property (nonatomic, assign)IBInspectable MKButtonEdgeInsetsStyle btnEdgeInstsStyle;

- (void)handleEvent:(UIControlEvents)controlEvent withBlock:(ActionBlock)action;

@end
