APCategoryViewController.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // APCategoryViewController.m
  3. // westkissMob
  4. //
  5. // Created by iOS on 2023/5/27.
  6. //
  7. #import "APCategoryViewController.h"
  8. @interface APCategoryViewController ()
  9. @property (nonatomic, strong) UIButton *closeBt;
  10. @property (nonatomic, strong) UILabel *titleLB;
  11. @end
  12. @implementation APCategoryViewController
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. self.searchTf.hidden = true;
  16. [self.topV addSubview:self.closeBt];
  17. [self.closeBt mas_makeConstraints:^(MASConstraintMaker *make) {
  18. make.bottom.equalTo(self.topV).offset(-10);
  19. make.right.equalTo(self.topV).offset(-22);
  20. make.width.height.equalTo(@40);
  21. }];
  22. [self.topV addSubview:self.titleLB];
  23. [self.titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.width.equalTo(@130);
  25. make.height.equalTo(@40);
  26. make.centerX.equalTo(self.topV);
  27. make.bottom.equalTo(self.topV).offset(-10);
  28. }];
  29. }
  30. - (void)showAction {
  31. self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  32. self.view.hidden = false;
  33. [UIView animateWithDuration:0.24 animations:^{
  34. self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  35. } completion:^(BOOL finished) {
  36. self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  37. }];
  38. }
  39. - (void)closeAction {
  40. self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  41. [UIView animateWithDuration:0.24 animations:^{
  42. self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  43. } completion:^(BOOL finished) {
  44. self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  45. self.view.hidden = true;
  46. }];
  47. }
  48. - (UIButton *)closeBt {
  49. if (!_closeBt) {
  50. UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
  51. [bt setImage:[UIImage imageNamed:@"productLsit_filter_close"] forState:UIControlStateNormal];
  52. [bt addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  53. _closeBt = bt;
  54. }
  55. return _closeBt;
  56. }
  57. - (UILabel *)titleLB {
  58. if (!_titleLB) {
  59. UILabel *lb = [[UILabel alloc] init];
  60. lb.text = @"MENU";
  61. lb.textColor = UIColor.blackColor;
  62. lb.font = [UIFont fontWithName:Rob_Regular size:20];
  63. lb.textAlignment = NSTextAlignmentCenter;
  64. _titleLB = lb;
  65. }
  66. return _titleLB;
  67. }
  68. @end