123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // addAudioToPlayListBottomView.m
- // Private-X
- //
- // Created by xd h on 2024/7/15.
- //
- #import "addAudioToPlayListBottomView.h"
- @interface addAudioToPlayListBottomView ()
- @property(nonatomic,strong) UIButton*bottomButton;
- @end
- @implementation addAudioToPlayListBottomView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- self.backgroundColor = [UIColor whiteColor];
- [self drawAnyView];
- return self;
- }
- - (void)drawAnyView{
-
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,SCREEN_W,40.f);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
-
- _bottomButton = [[UIButton alloc] init];
- [_bottomButton.layer addSublayer:gl];
-
- [_bottomButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [_bottomButton setTitle:NSLocalizedString(@"NAS_add_audio_to_play_list",nil) forState:UIControlStateNormal];
- [_bottomButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _bottomButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
- _bottomButton.layer.cornerRadius = 8;
- _bottomButton.layer.masksToBounds = YES;
- [self addSubview:_bottomButton];
- [self setButtonStateFunBy:NO];
-
- [_bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-15);
- make.left.mas_equalTo(15);
- make.height.mas_equalTo(40);
- make.top.mas_equalTo(10);
- }];
- }
- - (void)didClickButFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- - (void)setButtonStateFunBy:(BOOL)canClick
- {
- CGFloat alpha = canClick ? 1.0 : 0.5;
- _bottomButton.enabled = canClick;
-
- _bottomButton.alpha = alpha;
- }
- @end
|