Skip to content

Commit

Permalink
优化及增加效果图
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintGao committed May 21, 2018
1 parent 77e1966 commit eed2c40
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 140 deletions.
14 changes: 10 additions & 4 deletions GKWYMusic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
4770C39B21130770DC0280B1 /* Pods_GKWYMusic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 316EC85788B8A4208D922C6A /* Pods_GKWYMusic.framework */; };
603A126220887B95002A5BD3 /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = 603A126120887B95002A5BD3 /* Podfile */; };
603A1272208881A3002A5BD3 /* GKActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 603A126B208881A2002A5BD3 /* GKActionSheet.m */; };
603A1273208881A3002A5BD3 /* GKActionSheetViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 603A126C208881A2002A5BD3 /* GKActionSheetViewCell.m */; };
603A1274208881A3002A5BD3 /* GKDownloadModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 603A1270208881A2002A5BD3 /* GKDownloadModel.m */; };
Expand Down Expand Up @@ -81,6 +80,8 @@
60938F8620AE603F00CD8115 /* GKWYArtistRecModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 60938F8520AE603F00CD8115 /* GKWYArtistRecModel.m */; };
60938F8C20AEDA4A00CD8115 /* GKWYBaseSubViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 60938F8B20AEDA4A00CD8115 /* GKWYBaseSubViewController.m */; };
60938FAE20AFD1E900CD8115 /* GKWYArtistMainTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 60938FAD20AFD1E900CD8115 /* GKWYArtistMainTableView.m */; };
60938FBC20B1740400CD8115 /* GKWYIntroDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 60938FBB20B1740400CD8115 /* GKWYIntroDetailViewController.m */; };
60938FBE20B29DD300CD8115 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 60938FBD20B29DD300CD8115 /* README.md */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -103,7 +104,6 @@
/* Begin PBXFileReference section */
205E02C3FE102D1B4512A3B0 /* Pods-GKWYMusic.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GKWYMusic.release.xcconfig"; path = "Pods/Target Support Files/Pods-GKWYMusic/Pods-GKWYMusic.release.xcconfig"; sourceTree = "<group>"; };
316EC85788B8A4208D922C6A /* Pods_GKWYMusic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GKWYMusic.framework; sourceTree = BUILT_PRODUCTS_DIR; };
603A126120887B95002A5BD3 /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
603A126320887E68002A5BD3 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
603A1269208881A2002A5BD3 /* GKActionSheetViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GKActionSheetViewCell.h; sourceTree = "<group>"; };
603A126A208881A2002A5BD3 /* GKActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GKActionSheet.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -249,6 +249,9 @@
60938F8B20AEDA4A00CD8115 /* GKWYBaseSubViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GKWYBaseSubViewController.m; sourceTree = "<group>"; };
60938FAC20AFD1E900CD8115 /* GKWYArtistMainTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GKWYArtistMainTableView.h; sourceTree = "<group>"; };
60938FAD20AFD1E900CD8115 /* GKWYArtistMainTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GKWYArtistMainTableView.m; sourceTree = "<group>"; };
60938FBA20B1740400CD8115 /* GKWYIntroDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GKWYIntroDetailViewController.h; sourceTree = "<group>"; };
60938FBB20B1740400CD8115 /* GKWYIntroDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GKWYIntroDetailViewController.m; sourceTree = "<group>"; };
60938FBD20B29DD300CD8115 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
AC63263F3F790C8CA35FADA1 /* Pods-GKWYMusic.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GKWYMusic.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GKWYMusic/Pods-GKWYMusic.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -623,7 +626,7 @@
603F823220887A21004A8F29 /* Info.plist */,
603F823320887A21004A8F29 /* main.m */,
603A126320887E68002A5BD3 /* PrefixHeader.pch */,
603A126120887B95002A5BD3 /* Podfile */,
60938FBD20B29DD300CD8115 /* README.md */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -753,6 +756,8 @@
60938EFD20ABBA3B00CD8115 /* GKWYArtistVideoListViewController.m */,
60938F0020ABBBC600CD8115 /* GKWYArtistIntroViewController.h */,
60938F0120ABBBC600CD8115 /* GKWYArtistIntroViewController.m */,
60938FBA20B1740400CD8115 /* GKWYIntroDetailViewController.h */,
60938FBB20B1740400CD8115 /* GKWYIntroDetailViewController.m */,
60938F8A20AEDA4A00CD8115 /* GKWYBaseSubViewController.h */,
60938F8B20AEDA4A00CD8115 /* GKWYBaseSubViewController.m */,
);
Expand Down Expand Up @@ -960,8 +965,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
60938FBE20B29DD300CD8115 /* README.md in Resources */,
606176C420A581720054C8E1 /* LICENCE.md in Resources */,
603A126220887B95002A5BD3 /* Podfile in Resources */,
606176C620A581720054C8E1 /* README.md in Resources */,
603F822E20887A21004A8F29 /* Assets.xcassets in Resources */,
603A12CC208C44AA002A5BD3 /* audio.json in Resources */,
Expand Down Expand Up @@ -1109,6 +1114,7 @@
603A12B520899A49002A5BD3 /* GKWYMusicCoverView.m in Sources */,
6061769C209C0EB60054C8E1 /* GKWYSongViewCell.m in Sources */,
603A12B82089A92E002A5BD3 /* GKWYDiskView.m in Sources */,
60938FBC20B1740400CD8115 /* GKWYIntroDetailViewController.m in Sources */,
603A128A2088A899002A5BD3 /* GKSliderView.m in Sources */,
603A12CA208C37A0002A5BD3 /* GKWYListViewCell.m in Sources */,
60938EFB20ABB6AB00CD8115 /* GKWYArtistAlbumListViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ @interface GKWYAlbumViewController ()<UITableViewDataSource, UITableViewDelegate

@property (nonatomic, strong) NSArray *songs;

// 下载使用
@property (nonatomic, strong) GKWYMusicModel *currentModel;

@end
Expand Down Expand Up @@ -114,6 +115,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];

GKWYMusicModel *model = self.songs[indexPath.row];

[kWYPlayerVC playMusicWithModel:model];
Expand Down Expand Up @@ -188,6 +191,8 @@ - (void)cellDidClickArtistItem:(GKWYListViewCell *)cell model:(GKWYMusicModel *)

// 单个下载
- (void)downloadMusicWithModel:(GKWYMusicModel *)model {
self.currentModel = model;

if (model.isDownload) {
GKDownloadModel *dModel = [GKDownloadModel new];
dModel.fileID = model.song_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "GKWYArtistAlbumListViewController.h"
#import "GKWYAlbumViewController.h"
#import "GKWYAlbumViewCell.h"

#import "GKRefreshHeader.h"
Expand Down Expand Up @@ -84,4 +85,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];

GKWYAlbumViewController *albumVC = [GKWYAlbumViewController new];
albumVC.album_id = [self.dataList[indexPath.row] album_id];
[self.navigationController pushViewController:albumVC animated:YES];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
//

#import "GKWYArtistIntroViewController.h"
#import "GKWYArtistViewController.h"
#import "GKWYIntroViewCell.h"
#import "GKWYIntroDetailViewController.h"

@interface GKWYArtistIntroViewController ()

Expand Down Expand Up @@ -72,6 +74,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
GKWYIntroViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kWYIntroViewCellID];
cell.artistModel = self.model;
cell.dataList = self.dataList;
cell.introBtnClickBlock = ^{
GKWYIntroDetailViewController *detailVC = [GKWYIntroDetailViewController new];
detailVC.intro = self.model.intro;
[self.navigationController pushViewController:detailVC animated:YES];
};

cell.recArtistClickBlock = ^(GKWYArtistRecModel *model) {
GKWYArtistViewController *artistVC = [GKWYArtistViewController new];
artistVC.tinguid = model.ting_uid;
artistVC.artistid = model.artist_id;
[self.navigationController pushViewController:artistVC animated:YES];
};

return cell;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];

[kWYPlayerVC playMusicWithModel:self.dataList[indexPath.row]];
[self.navigationController pushViewController:kWYPlayerVC animated:YES];
}

#pragma mark - GKWYListViewCellDelegate
- (void)cellDidClickMVBtn:(GKWYListViewCell *)cell model:(GKWYMusicModel *)model {
[GKMessageTool showText:@"MV"];
Expand Down Expand Up @@ -156,6 +163,8 @@ - (void)cellDidClickMVItem:(GKWYListViewCell *)cell model:(GKWYMusicModel *)mode

// 单个下载
- (void)downloadMusicWithModel:(GKWYMusicModel *)model {
self.currentModel = model;

if (model.isDownload) {
GKDownloadModel *dModel = [GKDownloadModel new];
dModel.fileID = model.song_id;
Expand Down
36 changes: 20 additions & 16 deletions GKWYMusic/Classes/Home/Artist/Controller/GKWYArtistViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.effectView.alpha = alpha;

// 利用contentOffset处理内外层tableView的滑动冲突
// 滑动到达临界点时固定mainTableView的位置
if (offsetY >= criticalPoint) {
scrollView.contentOffset = CGPointMake(0, criticalPoint);
self.isCriticalPoint = YES;
Expand Down Expand Up @@ -225,7 +226,9 @@ - (void)pageController:(WMPageController *)pageController didEnterViewController

GKWYBaseSubViewController *vc = (GKWYBaseSubViewController *)viewController;

[vc loadData];
if (self.artistModel) {
[vc loadData];
}
}

#pragma mark - 懒加载
Expand All @@ -234,6 +237,7 @@ - (GKWYArtistMainTableView *)mainTableView {
_mainTableView = [[GKWYArtistMainTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_mainTableView.dataSource = self;
_mainTableView.delegate = self;
_mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_mainTableView.showsVerticalScrollIndicator = NO;
_mainTableView.contentInset = UIEdgeInsetsMake(kArtistHeaderHeight, 0, 0, 0);
}
Expand Down Expand Up @@ -320,29 +324,29 @@ - (UIView *)pageView {

- (GKPageController *)pageVC {
if (!_pageVC) {
_pageVC = [GKPageController new];
_pageVC.dataSource = self;
_pageVC.delegate = self;
_pageVC = [GKPageController new];
_pageVC.dataSource = self;
_pageVC.delegate = self;

// 菜单属性
_pageVC.menuItemWidth = KScreenW / 4.0f;
_pageVC.menuViewStyle = WMMenuViewStyleLine;
_pageVC.menuItemWidth = KScreenW / 4.0f;
_pageVC.menuViewStyle = WMMenuViewStyleLine;

// 菜单文字属性
_pageVC.titleSizeNormal = 16.0f;
_pageVC.titleSizeSelected = 16.0f;
_pageVC.titleColorNormal = [UIColor blackColor];
_pageVC.titleColorSelected = kAPPDefaultColor;
_pageVC.titleSizeNormal = 16.0f;
_pageVC.titleSizeSelected = 16.0f;
_pageVC.titleColorNormal = [UIColor blackColor];
_pageVC.titleColorSelected = kAPPDefaultColor;

// 进度条属性
_pageVC.progressColor = kAPPDefaultColor;
_pageVC.progressWidth = kAdaptive(60.0f);
_pageVC.progressHeight = 3.0f;
_pageVC.progressViewBottomSpace = kAdaptive(10.0f);
_pageVC.progressViewCornerRadius = _pageVC.progressHeight / 2;
_pageVC.progressColor = kAPPDefaultColor;
_pageVC.progressWidth = kAdaptive(60.0f);
_pageVC.progressHeight = 3.0f;
_pageVC.progressViewBottomSpace = kAdaptive(10.0f);
_pageVC.progressViewCornerRadius = _pageVC.progressHeight / 2;

// 调皮效果
_pageVC.progressViewIsNaughty = YES;
_pageVC.progressViewIsNaughty = YES;
}
return _pageVC;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ - (void)viewDidLoad {

self.gk_navigationBar.hidden = YES;

[self.tableView addSubview:self.loadingView];
[self.view addSubview:self.loadingView];
[self.tableView addSubview:self.loadLabel];
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.tableView).offset(20.0f);
make.top.equalTo(self.tableView).offset(40.0f);
make.centerX.equalTo(self.tableView);
}];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// GKWYIntroDetailViewController.h
// GKWYMusic
//
// Created by gaokun on 2018/5/20.
// Copyright © 2018年 gaokun. All rights reserved.
//

#import "GKWYBaseViewController.h"

@interface GKWYIntroDetailViewController : GKWYBaseViewController

@property (nonatomic, copy) NSString *intro;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// GKWYIntroDetailViewController.m
// GKWYMusic
//
// Created by gaokun on 2018/5/20.
// Copyright © 2018年 gaokun. All rights reserved.
//

#import "GKWYIntroDetailViewController.h"

@interface GKWYIntroDetailViewController ()

@property (nonatomic, strong) UIScrollView *scrollView;

@end

@implementation GKWYIntroDetailViewController

- (void)viewDidLoad {
[super viewDidLoad];

[self.view addSubview:self.scrollView];
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];

UILabel *contentLabel = [UILabel new];
contentLabel.textColor = [UIColor blackColor];
contentLabel.font = [UIFont systemFontOfSize:16.0f];
contentLabel.numberOfLines = 0;
contentLabel.text = self.intro;
[self.scrollView addSubview:contentLabel];

contentLabel.frame = CGRectMake(kAdaptive(20.0f), kAdaptive(20.0f), KScreenW - kAdaptive(40.0f), 0);
[contentLabel sizeToFit];

self.scrollView.contentSize = CGSizeMake(0, contentLabel.frame.size.height + kAdaptive(40.0f));
}

#pragma mark - 懒加载
- (UIScrollView *)scrollView {
if (!_scrollView) {
_scrollView = [UIScrollView new];
}
return _scrollView;
}

@end
3 changes: 3 additions & 0 deletions GKWYMusic/Classes/Home/Artist/View/GKWYIntroViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ static NSString *const kWYIntroViewCellID = @"GKWYIntroViewCell";
@property (nonatomic, strong) GKWYArtistModel *artistModel;
@property (nonatomic, strong) NSArray *dataList;

@property (nonatomic, copy) void(^introBtnClickBlock)(void);
@property (nonatomic, copy) void(^recArtistClickBlock)(GKWYArtistRecModel *model);

@end

@interface GKWYArtistRecView : UIView
Expand Down
17 changes: 17 additions & 0 deletions GKWYMusic/Classes/Home/Artist/View/GKWYIntroViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ - (void)setDataList:(NSArray *)dataList {
[dataList enumerateObjectsUsingBlock:^(GKWYArtistRecModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
GKWYArtistRecView *itemView = [GKWYArtistRecView new];
itemView.recModel = obj;
itemView.tag = 1000 + idx;
[self.recScrollView addSubview:itemView];

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recViewClick:)];
[itemView addGestureRecognizer:tap];

itemView.frame = CGRectMake(x, y, w, h);

x += (w + margin);
Expand All @@ -125,6 +129,18 @@ - (void)setDataList:(NSArray *)dataList {
self.recScrollView.contentSize = CGSizeMake(2 * kAdaptive(10.0f) + dataList.count * w + (dataList.count - 1) * margin, 0);
}

- (void)introBtnClick:(id)sender {
!self.introBtnClickBlock ? : self.introBtnClickBlock();
}

- (void)recViewClick:(UITapGestureRecognizer *)tap {
NSInteger tag = tap.view.tag - 1000;

GKWYArtistRecModel *model = self.dataList[tag];

!self.recArtistClickBlock ? : self.recArtistClickBlock(model);
}

#pragma mark - 懒加载
- (UIView *)introNameView {
if (!_introNameView) {
Expand Down Expand Up @@ -159,6 +175,7 @@ - (UIButton *)introBtn {
[_introBtn setTitleColor:GKColorGray(150.0f) forState:UIControlStateNormal];
_introBtn.titleLabel.font = [UIFont systemFontOfSize:15.0f];
[_introBtn setTitle:@"完整歌手介绍 >" forState:UIControlStateNormal];
[_introBtn addTarget:self action:@selector(introBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _introBtn;
}
Expand Down
Loading

0 comments on commit eed2c40

Please sign in to comment.