// // APCategoryViewController.m // westkissMob // // Created by iOS on 2023/5/27. // #import "APCategoryViewController.h" @interface APCategoryViewController () @property (nonatomic, strong) UIButton *closeBt; @property (nonatomic, strong) UILabel *titleLB; @end @implementation APCategoryViewController - (void)viewDidLoad { [super viewDidLoad]; self.searchTf.hidden = true; [self.topV addSubview:self.closeBt]; [self.closeBt mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self.topV).offset(-10); make.right.equalTo(self.topV).offset(-22); make.width.height.equalTo(@40); }]; [self.topV addSubview:self.titleLB]; [self.titleLB mas_makeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@130); make.height.equalTo(@40); make.centerX.equalTo(self.topV); make.bottom.equalTo(self.topV).offset(-10); }]; } - (void)showAction { self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT); self.view.hidden = false; [UIView animateWithDuration:0.24 animations:^{ self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } completion:^(BOOL finished) { self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); }]; } - (void)closeAction { self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); [UIView animateWithDuration:0.24 animations:^{ self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } completion:^(BOOL finished) { self.view.frame = CGRectMake(-SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT); self.view.hidden = true; }]; } - (UIButton *)closeBt { if (!_closeBt) { UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom]; [bt setImage:[UIImage imageNamed:@"productLsit_filter_close"] forState:UIControlStateNormal]; [bt addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside]; _closeBt = bt; } return _closeBt; } - (UILabel *)titleLB { if (!_titleLB) { UILabel *lb = [[UILabel alloc] init]; lb.text = @"MENU"; lb.textColor = UIColor.blackColor; lb.font = [UIFont fontWithName:Rob_Regular size:20]; lb.textAlignment = NSTextAlignmentCenter; _titleLB = lb; } return _titleLB; } @end