123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- //
- // YOUPAILZMusicWindow.m
- // YOUQU
- //
- // Created by CY on 2021/12/10.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZMusicWindow.h"
- #import "JXCategoryView.h"
- #import "YOUPAIJXCategoryTitleBackgroundView.h"
- #import "JXCategoryListContainerView.h"
- #import "YOUPAILZMyMusicVC.h"
- #import "YOUPAILZHotMusicVC.h"
- //#import "IQKeyboardManager.h"
- @interface YOUPAILZMusicWindow ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @property (nonatomic, weak) UIView *youpaipbgV;
- @property (nonatomic, weak) YOUPAIJXCategoryTitleBackgroundView *youpaipcategoryView;
- @end
- @implementation YOUPAILZMusicWindow
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.baseView.hidden = YES;
- [self youpaifinitUI];
- }
- - (void)youpaifinitUI{
- UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, 345.0f)];
- bgV.backgroundColor = LCBkgColor;
- [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(20.0f, 20.0f)];
- [self.view addSubview:bgV];
- self.youpaipbgV = bgV;
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.offset(0.0f);
- make.height.offset(345.0f);
- }];
-
- UIView *navV = [[UIView alloc] init];
- [bgV addSubview:navV];
- [navV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.right.offset(0.0f);
- make.height.offset(50.0f);
- }];
- [navV addLineWithColor:[[UIColor whiteColor] colorWithAlphaComponent:0.07f] lineRect:CGRectMake(0.0f, 49.5f, KScreenWidth, 0.5f)];
-
- UIButton *youpaipcloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_navigation_back_black"] forState:UIControlStateNormal];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_navigation_back_black"] forState:UIControlStateHighlighted];
- [youpaipcloseBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [navV addSubview:youpaipcloseBtn];
- [youpaipcloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(4.0f);
- make.centerY.equalTo(navV);
- make.size.mas_offset(CGSizeMake(44.0f, 44.0f));
- }];
-
- YOUPAIJXCategoryTitleBackgroundView *youpaipcategoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] init];
- youpaipcategoryView.backgroundColor = [UIColor clearColor];
- youpaipcategoryView.titles = self.titles;
- youpaipcategoryView.delegate = self;
- youpaipcategoryView.titleSelectedColor = HexColorFromRGB(0xF4003F);
- youpaipcategoryView.titleColor = HexColorFromRGB(0xffffff);
- youpaipcategoryView.titleColorGradientEnabled = YES;
- youpaipcategoryView.titleFont = LCFont(16.0f);
- youpaipcategoryView.titleSelectedFont = LCFont(16.0f);
- youpaipcategoryView.averageCellSpacingEnabled = YES;
- youpaipcategoryView.normalBackgroundColor = [UIColor clearColor];
- youpaipcategoryView.selectedBackgroundColor = [UIColor clearColor];
- youpaipcategoryView.cellWidthIncrement = 0;
- youpaipcategoryView.normalBorderColor = [UIColor clearColor];
- youpaipcategoryView.selectedBorderColor = [UIColor clearColor];
- youpaipcategoryView.borderLineWidth = 0;
- youpaipcategoryView.backgroundCornerRadius = 0.0f;
- [navV addSubview:youpaipcategoryView];
- self.youpaipcategoryView = youpaipcategoryView;
- [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(navV);
- make.size.mas_offset(CGSizeMake(260.0f, 43.0f));
- }];
-
- JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
- lineView.verticalMargin = 4.0f;
- lineView.indicatorHeight = 2.5f;
- lineView.indicatorWidth = 8.0f;
- lineView.indicatorColor = HexColorFromRGB(0xF4003F);
- youpaipcategoryView.indicators = @[lineView];
-
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.listCellBackgroundColor = LCBkgColor;
- [bgV addSubview:pagerView];
- youpaipcategoryView.listContainer = pagerView;
-
- [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.offset(0.0f);
- make.top.equalTo(navV.mas_bottom).offset(0.0f);
- }];
-
- }
- - (void)youpaifcloseBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{}];
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [self.view endEditing:YES];
- UITouch *touch = [touches.allObjects lastObject];
- if (touch.view == self.view && self.isTouchDismiss) {
- [self dismissViewControllerAnimated:YES completion:nil];
- }
-
- }
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
- return self.titles.count;
- }
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- if (index == 0) {
- YOUPAILZMyMusicVC *vc = [YOUPAILZMyMusicVC new];
- @weakify(self);
- [vc setGoHotMusicListBlock:^{
- @strongify(self);
- [self.youpaipcategoryView selectItemAtIndex:1];
- }];
- return vc;
- }else{
- YOUPAILZHotMusicVC *vc = [YOUPAILZHotMusicVC new];
- @weakify(self);
- [vc setKeyboardWillHideBlock:^{
- @strongify(self);
- [self.view layoutIfNeeded];
- [UIView animateWithDuration:0.25f animations:^{
- [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- make.bottom.offset(0.0f);
- }];
- [self.view layoutIfNeeded];
- }];
-
- }];
- [vc setKeyboardWillShowBlock:^(CGFloat keyboardHeight) {
- @strongify(self);
- [self.view layoutIfNeeded];
- [UIView animateWithDuration:0.25f animations:^{
- [self.youpaipbgV mas_updateConstraints:^(MASConstraintMaker *make) {
- make.bottom.offset(-keyboardHeight + (345.0f - 50.0f - 58.0f));
- }];
- [self.view layoutIfNeeded];
- }];
- }];
- return vc;
- }
- }
- - (NSArray <NSString *> *)titles{
- return @[@"我的音乐",@"热门音乐"];
- }
- @end
|