ZZExViewController.m 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // ZZViewController.m
  3. // ZZUIKitEx
  4. //
  5. // Created by bymiracles@163.com on 01/07/2021.
  6. // Copyright (c) 2021 bymiracles@163.com. All rights reserved.
  7. //
  8. #import "ZZExViewController.h"
  9. #import <ZZUIKit/ZZUIKitEx.h>
  10. @interface ZZExViewController ()
  11. @property(nonatomic,strong) UIImageView *imgV;
  12. @property (weak, nonatomic) IBOutlet UIButton *testBtn;
  13. @property(nonatomic,strong) UILabel *paddingLab;
  14. @end
  15. @implementation ZZExViewController
  16. - (void)viewDidLoad
  17. {
  18. [super viewDidLoad];
  19. // Do any additional setup after loading the view, typically from a nib.
  20. // self.view.backgroundColor = zz_RGBHex(0xff3333);
  21. [self configUI2];
  22. }
  23. -(void)configUI2{
  24. [self.testBtn zz_contentReverse:10];
  25. // self.testBtn.frame = CGRectMake(100, 100, 100, 100);
  26. self.testBtn.zz_click(^(UIControl *btn){
  27. [self.testBtn zz_imgAnmimaRotate];
  28. });
  29. _paddingLab = [UILabel new];
  30. _paddingLab.text = @"x";
  31. _paddingLab.zz_padding = UIEdgeInsetsMake(0, 10, 0, 0);
  32. _paddingLab.zz_x = 100;
  33. _paddingLab.zz_y = 100;
  34. // _paddingLab.zz_strokeWidth = 10;
  35. _paddingLab.zz_strokeColor = [UIColor redColor];
  36. [self.view addSubview:_paddingLab];
  37. [self.paddingLab sizeToFit];
  38. _paddingLab.backgroundColor = [UIColor lightGrayColor];
  39. }
  40. -(void)configUI1{
  41. _imgV = [[UIImageView alloc] init];
  42. [self.view addSubview:_imgV];
  43. _imgV.frame = CGRectMake(100, 200, 200, 400);
  44. _imgV.layer.borderColor = zz_RGBHex(0x000000).CGColor;
  45. _imgV.layer.borderWidth = 5;
  46. _imgV.image = zz_imgNamed(@"");
  47. self.view.zz_tapAction(^(UIView *view){
  48. self.imgV.image = [self.view zz_shot];
  49. });
  50. self.view.zz_longTapBlock = (^(UIView *view){
  51. NSLog(@"你好啊,小老弟");
  52. });
  53. ZZThrottleBtn *btn = [ZZThrottleBtn buttonWithType:UIButtonTypeSystem];
  54. [btn setTitle:@"click me" forState:UIControlStateNormal];
  55. btn.zz_throttleState = UIControlStateDisabled;
  56. btn.frame = CGRectMake(100, 60, 100, 40);
  57. btn.backgroundColor = [UIColor purpleColor];
  58. btn.zz_throttleDuration = 5;
  59. btn.zz_click(^(UIControl *btn){
  60. NSLog(@"%@",btn);
  61. });
  62. [btn setZz_backgroundColor:[UIColor redColor] forState:UIControlStateNormal];
  63. [btn setZz_backgroundColor:[UIColor yellowColor] forState:UIControlStateHighlighted];
  64. [btn setZz_backgroundColor:[UIColor greenColor] forState:UIControlStateDisabled];
  65. [self.view addSubview:btn];
  66. NSLog(@"UIControlStateNormal bgc is %@",[btn zz_backgroundColorForState:UIControlStateNormal]);
  67. NSLog(@"UIControlStateHighlighted bgc is %@",[btn zz_backgroundColorForState:UIControlStateHighlighted]);
  68. NSLog(@"UIControlStateDisabled bgc is %@",[btn zz_backgroundColorForState:UIControlStateDisabled]);
  69. self.view.backgroundColor = [btn zz_backgroundColorForState:UIControlStateHighlighted];
  70. }
  71. - (void)didReceiveMemoryWarning
  72. {
  73. [super didReceiveMemoryWarning];
  74. // Dispose of any resources that can be recreated.
  75. }
  76. @end