//
//  screeningButton.m
//  Lighting
//
//  Created by 曹云霄 on 16/5/13.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "screeningButton.h"

@implementation screeningButton



- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return self;
}



- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    return CGRectMake((self.frame.size.width-[self ReturnCGsize:self.currentTitle].width)/2, (self.frame.size.height-35)/2, [self ReturnCGsize:self.currentTitle].width, 35);
}


- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    return CGRectMake((self.frame.size.width-[self ReturnCGsize:self.currentTitle].width)/2+[self ReturnCGsize:self.currentTitle].width, (self.frame.size.height-6)/2, 11, 6);
}


- (CGSize)ReturnCGsize:(NSString *)string
{
    CGSize S = [string boundingRectWithSize:CGSizeMake(999, 35) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18]} context:nil].size;
    return S;
}


@end
