//
//  MyToolBar.m
//  CapitalChamberlain
//
//  Created by Jerry on 15/12/23.
//  Copyright © 2015年 SunShine. All rights reserved.
//

#import "MyToolBar.h"

@implementation MyToolBar


- (instancetype)initWithFrame:(CGRect)frame target:(id)target lefTitle:(NSString *)leftTitle leftAction:(SEL)leftAcrtion rightTitle:(NSString *)rightTitle rightAction:(SEL)rightAction
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setBarStyle:UIBarStyleDefault];
//        self.backgroundColor = kBackroundColor;
        
        UIBarButtonItem * helloButton = [[UIBarButtonItem alloc]initWithTitle:leftTitle style:UIBarButtonItemStyleBordered target:target action:leftAcrtion];
        
        UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:target action:nil];
        
        UIBarButtonItem * doneButton = [[UIBarButtonItem alloc]initWithTitle:rightTitle style:UIBarButtonItemStyleDone target:target action:rightAction];
        
        [doneButton setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor],NSForegroundColorAttributeName, [UIFont systemFontOfSize:17],NSFontAttributeName ,nil] forState:UIControlStateNormal];
        
        
        NSArray * buttonsArray = [NSArray arrayWithObjects:helloButton,btnSpace,doneButton,nil];
        [self setItems:buttonsArray];
    }
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
