MTBaseButton.m 967 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // MTBaseButton.m
  3. //
  4. // Created by Simon on 2019/3/22.
  5. // Copyright © 2019 Simon. All rights reserved.
  6. //
  7. #import "MTBaseButton.h"
  8. @implementation MTBaseButton
  9. //UIButton方法实现
  10. +(MTBaseButton *)buttonWithFrame:(CGRect)rect title:(NSString *)title imageName:(NSString *)imageName titleColor:(UIColor *)color titleFont:(int)size
  11. {
  12. MTBaseButton *bt = [MTBaseButton buttonWithType:UIButtonTypeCustom];
  13. bt.frame = rect;
  14. [bt setTitle:title forState:UIControlStateNormal];
  15. [bt setTitleColor:color forState:UIControlStateNormal];
  16. bt.titleLabel.font = font(size);
  17. [bt setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
  18. return bt;
  19. }
  20. +(MTBaseButton *)buttonWithFrame:(CGRect)rect imageName:(NSString *)imageName{
  21. MTBaseButton *bt = [MTBaseButton buttonWithType:UIButtonTypeCustom];
  22. bt.frame = rect;
  23. [bt setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
  24. return bt;
  25. }
  26. @end