Commit 0a2586c5 cgx

修复白噪音功能模块相关bug

1 个父辈 cc16cf97
正在显示 26 个修改的文件 包含 192 行增加94 行删除
......@@ -1011,26 +1011,10 @@
D0A72E36282B539200EED7BE /* WhiteNoise */ = {
isa = PBXGroup;
children = (
D01BD423282BFFB400BA86B3 /* WhiteNoiseRequestModel.h */,
D01BD424282BFFB400BA86B3 /* WhiteNoiseRequestModel.m */,
D01BD426282C003900BA86B3 /* NoiseTypeModel.h */,
D01BD427282C003900BA86B3 /* NoiseTypeModel.m */,
D01BD429282C03FC00BA86B3 /* NoiseAudioModel.h */,
D01BD42A282C03FC00BA86B3 /* NoiseAudioModel.m */,
D01BD42C282C06D200BA86B3 /* NoiseListController.h */,
D01BD42D282C06D200BA86B3 /* NoiseListController.m */,
D0D00197282C9402004EAFA1 /* NoiseView.h */,
D0D00198282C9402004EAFA1 /* NoiseView.m */,
D0A750FA282DE21D00589B0E /* NoiseAudioCell.h */,
D0A750FB282DE21D00589B0E /* NoiseAudioCell.m */,
D0A75106282E2A8500589B0E /* NoisePlayBar.h */,
D0A75107282E2A8500589B0E /* NoisePlayBar.m */,
D0A7510C282E2FEF00589B0E /* NoisePlayView.h */,
D0A7510D282E2FEF00589B0E /* NoisePlayView.m */,
D0A7510F282E3D0D00589B0E /* NoisePlayCell.h */,
D0A75110282E3D0D00589B0E /* NoisePlayCell.m */,
D0A75113282E499200589B0E /* NoiseDataManager.h */,
D0A75114282E499200589B0E /* NoiseDataManager.m */,
D0D20C40282F68C500C9374D /* View */,
D0D20C42282F68EE00C9374D /* Model */,
D0D20C43282F690A00C9374D /* Controller */,
D0D20C41282F68E100C9374D /* RequestModel */,
);
path = WhiteNoise;
sourceTree = "<group>";
......@@ -1124,6 +1108,54 @@
path = UserLogin;
sourceTree = "<group>";
};
D0D20C40282F68C500C9374D /* View */ = {
isa = PBXGroup;
children = (
D0D00197282C9402004EAFA1 /* NoiseView.h */,
D0D00198282C9402004EAFA1 /* NoiseView.m */,
D0A750FA282DE21D00589B0E /* NoiseAudioCell.h */,
D0A750FB282DE21D00589B0E /* NoiseAudioCell.m */,
D0A75106282E2A8500589B0E /* NoisePlayBar.h */,
D0A75107282E2A8500589B0E /* NoisePlayBar.m */,
D0A7510C282E2FEF00589B0E /* NoisePlayView.h */,
D0A7510D282E2FEF00589B0E /* NoisePlayView.m */,
D0A7510F282E3D0D00589B0E /* NoisePlayCell.h */,
D0A75110282E3D0D00589B0E /* NoisePlayCell.m */,
);
path = View;
sourceTree = "<group>";
};
D0D20C41282F68E100C9374D /* RequestModel */ = {
isa = PBXGroup;
children = (
D01BD423282BFFB400BA86B3 /* WhiteNoiseRequestModel.h */,
D01BD424282BFFB400BA86B3 /* WhiteNoiseRequestModel.m */,
);
path = RequestModel;
sourceTree = "<group>";
};
D0D20C42282F68EE00C9374D /* Model */ = {
isa = PBXGroup;
children = (
D01BD426282C003900BA86B3 /* NoiseTypeModel.h */,
D01BD427282C003900BA86B3 /* NoiseTypeModel.m */,
D01BD429282C03FC00BA86B3 /* NoiseAudioModel.h */,
D01BD42A282C03FC00BA86B3 /* NoiseAudioModel.m */,
D0A75113282E499200589B0E /* NoiseDataManager.h */,
D0A75114282E499200589B0E /* NoiseDataManager.m */,
);
path = Model;
sourceTree = "<group>";
};
D0D20C43282F690A00C9374D /* Controller */ = {
isa = PBXGroup;
children = (
D01BD42C282C06D200BA86B3 /* NoiseListController.h */,
D01BD42D282C06D200BA86B3 /* NoiseListController.m */,
);
path = Controller;
sourceTree = "<group>";
};
D0D3826428124E34005BB219 /* Feedback */ = {
isa = PBXGroup;
children = (
......@@ -1239,12 +1271,12 @@
D0F808FA280420DE0097899F /* Model */ = {
isa = PBXGroup;
children = (
D01814EC28002DC700583D4E /* HeaderDataModel.h */,
D01814ED28002DC700583D4E /* HeaderDataModel.m */,
D0DF90AC2814390000FC0F64 /* BannerModel.h */,
D0DF90AD2814390000FC0F64 /* BannerModel.m */,
D0DB33A628224D5100E15914 /* PromotionModel.h */,
D0DB33A728224D5100E15914 /* PromotionModel.m */,
D01814EC28002DC700583D4E /* HeaderDataModel.h */,
D01814ED28002DC700583D4E /* HeaderDataModel.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1870,7 +1902,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = SPH85C3TWU;
EXCLUDED_ARCHS = "";
FRAMEWORK_SEARCH_PATHS = (
......@@ -1908,7 +1940,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 1.0.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
......@@ -1936,7 +1968,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -1973,7 +2005,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 1.0.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
......@@ -2063,7 +2095,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -2100,7 +2132,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 1.0.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
......
......@@ -38,6 +38,10 @@ FOUNDATION_EXTERN NSString * const WXLoginAuthNoti;
FOUNDATION_EXTERN NSString * const HasUpdateUserDataNoti;
// 刷新主页通知
FOUNDATION_EXTERN NSString * const NeedUpdateHomePage;
// 首页白噪音播放列表变化通知
FOUNDATION_EXTERN NSString * const NoisePlaylistHasChange;
// 首页白噪音定时器被点击通知
FOUNDATION_EXTERN NSString * const NoiseTimingDidClick;
// 用户基础信息
FOUNDATION_EXTERN NSString * const UserBasicInfo;
......
......@@ -27,6 +27,8 @@ NSString * const ExpireTime2 = @"06:00:00";
NSString * const WXLoginAuthNoti = @"wxLoginAuthNoti";
NSString * const HasUpdateUserDataNoti = @"hasUpdateUserDataNoti";
NSString * const NeedUpdateHomePage = @"NeedUpdateHomePageNoti";
NSString * const NoisePlaylistHasChange = @"NoisePlaylistHasChangeNoti";
NSString * const NoiseTimingDidClick = @"NoiseTimingDidClickNoti";
NSString * const UserBasicInfo = @"UserBasicInfo";
......
......@@ -15,6 +15,7 @@
#import "SafeSleepRequestModel.h"
#import "WhiteNoiseRequestModel.h"
#import "NoisePlayBar.h"
#import "NoiseDataManager.h"
@interface HomeViewController ()
@property (nonatomic, strong) DSHomeView *homeTV;
......@@ -58,6 +59,12 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needUpdate) name:NeedUpdateHomePage object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[[NoiseDataManager sharedNoiseDataManager] stopNoiseAudio];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateHomePage object:nil];
}
......
......@@ -42,7 +42,7 @@
#pragma mark - Actions
- (void)timerSetting:(UIButton *)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:@"timingDidClickNoti" object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:NoiseTimingDidClick object:nil];
}
#pragma mark - lazy
......
......@@ -13,6 +13,7 @@
@interface NoiseListController () <UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *noiseAudioView;
@property (nonatomic, strong) NSArray *noiseAudioArr;
@property (nonatomic, strong) ExceptionDefaultView *exceptionView;
@end
@implementation NoiseListController {
......@@ -21,6 +22,7 @@
- (instancetype)initWithNoiseTypeID:(NSInteger)typeID {
if (self = [super init]) {
// 白噪音类型id
_typeID = typeID;
}
return self;
......@@ -32,10 +34,23 @@
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.view addSubview:self.noiseAudioView];
[self queryRelaxWhiteNoiseAudiosRequest];
}
- (void)queryRelaxWhiteNoiseAudiosRequest {
[WhiteNoiseRequestModel queryRelaxWhiteNoiseAudiosWithTypeID:_typeID completion:^(WhiteNoiseRequestModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
self.exceptionView.hidden = YES;
self.noiseAudioArr = requestModel.noiseAudioArr;
[self.noiseAudioView reloadData];
// 重置
NSArray *playList = [NoiseDataManager sharedNoiseDataManager].playList;
for (NoiseAudioCell *audioCell in playList) {
[audioCell.model.audioStream stop];
}
[NoiseDataManager sharedNoiseDataManager].playList = @[];
} else {
self.exceptionView.hidden = NO;
}
}];
}
......@@ -47,14 +62,28 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
NoiseAudioCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"NoiseAudioCellID" forIndexPath:indexPath];
cell.model = self.noiseAudioArr[indexPath.row];
NoiseAudioModel *model = self.noiseAudioArr[indexPath.row];
cell.model = model;
// 处理数据刷新后之前已经被选中的cell需要恢复被选中状态并配置播放器(只能根据音频id判断),暂不处理
// NSArray *playList = [NoiseDataManager sharedNoiseDataManager].playList;
// for (__strong NoiseAudioCell *oldCell in playList) {
// if (cell.model.noise_audio_id == oldCell.model.noise_audio_id) {
// cell.audioIV.selected = YES;
// cell.model = oldCell.model;
// // 将oldCell替换成新的cell
// oldCell = cell;
// // 替换model
// model = oldCell.model;
// }
// }
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NoiseAudioModel *model = [self.noiseAudioArr objectAtIndex:indexPath.row];
NoiseAudioCell *cell = (NoiseAudioCell *)[collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];
cell.model = model;
NSArray *playList = [NoiseDataManager sharedNoiseDataManager].playList;
NSMutableArray *selectedDataArr = [NSMutableArray arrayWithArray:playList];
......@@ -70,14 +99,13 @@
FSAudioStream *audioStream = [[FSAudioStream alloc] init];
audioStream.strictContentTypeChecking = NO;
audioStream.defaultContentType = @"audio/mpeg";
audioStream.volume = .5;
model.audioStream = audioStream;
[selectedDataArr addObject:cell];
playList = [selectedDataArr copy];
} else {
// 白噪音已经选择了则从播放列表移除
if (model.audioStream) {
[model.audioStream stop];
}
if (model.audioStream) { [model.audioStream stop]; }
[selectedDataArr removeObject:cell];
}
cell.audioIV.selected = !cell.audioIV.selected;
......@@ -109,4 +137,15 @@
return _noiseAudioArr;
}
- (ExceptionDefaultView *)exceptionView {
if (!_exceptionView) {
WS(weakSelf);
_exceptionView = [[ExceptionDefaultView alloc] initWithType:ExceptionTypeNet block:^{
weakSelf.exceptionView.hidden = YES;
[weakSelf queryRelaxWhiteNoiseAudiosRequest];
} superView:self.noiseAudioView];
}
return _exceptionView;
}
@end
......@@ -16,8 +16,10 @@ SingletonH(NoiseDataManager)
/// 选中的白噪音数据
@property (nonatomic, strong) NSArray *playList;
/// 用于存储播放流对象
@property (nonatomic, strong) NSArray *audioStreamArr;
/// 停止白噪音
- (void)stopNoiseAudio;
@end
NS_ASSUME_NONNULL_END
......@@ -6,6 +6,7 @@
//
#import "NoiseDataManager.h"
#import "NoiseAudioCell.h"
@implementation NoiseDataManager
......@@ -14,11 +15,16 @@ SingletonM(NoiseDataManager)
- (void)setPlayList:(NSArray *)playList {
_playList = playList;
[[NSNotificationCenter defaultCenter] postNotificationName:@"updatePlistNoti" object:nil userInfo:@{@"playList":self.playList}];
[[NSNotificationCenter defaultCenter] postNotificationName:NoisePlaylistHasChange object:nil userInfo:@{@"playList":self.playList}];
}
- (void)setAudioStreamArr:(NSArray *)audioStreamArr {
_audioStreamArr = audioStreamArr;
- (void)stopNoiseAudio {
if (self.playList && self.playList.count) {
for (int i = 0; i < self.playList.count; i++) {
NoiseAudioCell *audioCell = self.playList[i];
[audioCell.model.audioStream stop];
}
}
}
@end
......@@ -22,11 +22,6 @@
NSMutableArray *tmpArr = [NSMutableArray array];
for (int i = 0; i < resultArr.count; i++) {
NoiseTypeModel *noiseTypeModel = [NoiseTypeModel yy_modelWithJSON:resultArr[i]];
// if (i == 0) {
// noiseTypeModel.is_lock = 0;
// } else {
// noiseTypeModel.is_lock = ![LoginUtils getUserLoginData];
// }
[tmpArr addObject:noiseTypeModel];
}
requestModel.noiseTypeArr = [tmpArr copy];
......@@ -42,7 +37,7 @@
WhiteNoiseRequestModel * requestModel = [[WhiteNoiseRequestModel alloc] init];
NSString *api = @"query_relax_white_noise_audios_for_IOS";
NSString *argStr = [NSString stringWithFormat:@"query{%@(type_id:%ld)}", api, typeID];
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:YES success:^(NSDictionary * _Nonnull apiDic) {
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:NO success:^(NSDictionary * _Nonnull apiDic) {
DSLog(@"睡眠-放松训练-白噪声列表接口apiDic:%@", apiDic);
requestModel.resCode = DSResCodeSuccess;
NSArray *resultArr = apiDic[@"result"];
......
......@@ -65,10 +65,10 @@
self.minuteIndex = 0;
self.countTime = 60;
// 添加对单例对象播放列表变化通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePlist:) name:@"updatePlistNoti" object:nil];
// 添加对单例对象白噪音播放列表变化通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePlist:) name:NoisePlaylistHasChange object:nil];
// 监听定时按钮被点击事件通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openTimingView) name:@"timingDidClickNoti" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openTimingView) name:NoiseTimingDidClick object:nil];
}
return self;
}
......@@ -84,6 +84,9 @@
__weak FSAudioStream *audioStream = audioCell.model.audioStream;
audioStream.onStateChange = ^(FSAudioStreamState state) {
weakSelf.playBtn.selected = state == kFsAudioStreamPlaying;
if (self->_noisePlayView) {
weakSelf.noisePlayView.selected = weakSelf.playBtn.selected;
}
// 如果播放完成则重复播放
if (state == kFsAudioStreamPlaybackCompleted) {
[audioStream play];
......@@ -97,8 +100,8 @@
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updatePlistNoti" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"timingDidClickNoti" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NoisePlaylistHasChange object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NoiseTimingDidClick object:nil];
[_timer invalidate];
_timer = nil;
......@@ -111,7 +114,7 @@
}
- (void)showAudioListView {
[self.noisePlayView show];
[self.noisePlayView showNoisePlayViewWith:self.playBtn.selected];
}
- (void)playNoiseAudio:(UIButton *)sender {
......
......@@ -20,13 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface NoisePlayCell : UITableViewCell
@property (nonatomic, weak) id<NoisePlayCellDelegate> delegate;
@property (nonatomic, strong) NoiseAudioModel *model;
@property (nonatomic, strong) NSIndexPath *indexPath;
@end
NS_ASSUME_NONNULL_END
......@@ -22,7 +22,7 @@
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.dk_backgroundColorPicker = DKColorPickerWithColors(BGColor, AlertDarkColor, DSWhite);
self.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.bgView];
......
......@@ -11,7 +11,12 @@ NS_ASSUME_NONNULL_BEGIN
@interface NoisePlayView : UIView
- (void)show;
/// 显示白噪音列表页面
/// @param selected 按钮状态
- (void)showNoisePlayViewWith:(BOOL)selected;
/// 设置一键开启、一键暂停按钮状态
@property (nonatomic, assign) BOOL selected;
@end
......
......@@ -25,6 +25,7 @@
[self addSubview:self.headView];
[self addSubview:self.playListView];
[self addSubview:self.oneClickBtn];
[self.oneClickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.size.mas_equalTo(CGSizeMake(155, 40));
......@@ -34,7 +35,7 @@
return self;
}
- (void)show {
- (void)showNoisePlayViewWith:(BOOL)selected {
[DSKeyWindow addSubview:self];
NSArray *playList = [NoiseDataManager sharedNoiseDataManager].playList;
......@@ -42,15 +43,23 @@
self.audioArr = playList;
[self.playListView reloadData];
}
self.oneClickBtn.selected = selected;
}
- (void)setSelected:(BOOL)selected {
_selected = selected;
self.oneClickBtn.selected = selected;
}
#pragma mark - Actions
- (void)oneClickAction:(UIButton *)sender {
for (NoiseAudioCell *audioCell in self.audioArr) {
FSAudioStream *audioStream = audioCell.model.audioStream;
if (sender.selected) {
[audioStream pause];
[audioStream stop];
} else {
[audioStream pause];
[audioStream play];
}
}
sender.selected = !sender.selected;
......@@ -174,6 +183,7 @@
_playListView.bounces = NO;
_playListView.delegate = self;
_playListView.dataSource = self;
_playListView.separatorStyle = UITableViewCellSeparatorStyleNone;
_playListView.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
}
return _playListView;
......@@ -181,11 +191,11 @@
- (UIButton *)oneClickBtn {
if (!_oneClickBtn) {
_oneClickBtn = [UIButton btnWithTitle:@"一键暂停" titleColor:DSWhite font:BoldFont(16) bgColor:BrandColor];
_oneClickBtn = [UIButton btnWithTitle:@"" titleColor:DSWhite font:BoldFont(16) bgColor:BrandColor];
[_oneClickBtn addTarget:self action:@selector(oneClickAction:) forControlEvents:UIControlEventTouchUpInside];
[_oneClickBtn cornerRadius:22];
[_oneClickBtn setTitle:@"一键暂停" forState:UIControlStateNormal];
[_oneClickBtn setTitle:@"一键开启" forState:UIControlStateSelected];
[_oneClickBtn setTitle:@"一键开启" forState:UIControlStateNormal];
[_oneClickBtn setTitle:@"一键暂停" forState:UIControlStateSelected];
}
return _oneClickBtn;
}
......
......@@ -211,7 +211,7 @@ static NSString *mainCell = @"inxx_mainCell";
scrollViewPage.showsVerticalScrollIndicator = NO;
scrollViewPage.showsHorizontalScrollIndicator = NO;
scrollViewPage.delegate = self;
scrollViewPage.backgroundColor = _pageBarBgColor;
scrollViewPage.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self addSubview:scrollViewPage];
CGFloat contentWidth = 0;
......@@ -269,12 +269,12 @@ CGRect childFrame;
[self addSubview:collection];
[self bringSubviewToFront:self.collectionMain];
// childFrame = frame;
// for (UIViewController *childVc in self.controllersClass) {
// //子控制器的frame.origin.y肯定要从其自己的0开始
// childFrame.origin.y = 0;
// childVc.view.frame = childFrame;
// }
// childFrame = frame;
// for (UIViewController *childVc in self.controllersClass) {
// //子控制器的frame.origin.y肯定要从其自己的0开始
// childFrame.origin.y = 0;
// childVc.view.frame = childFrame;
// }
}
- (void)addPageBottomLine {
......@@ -594,7 +594,7 @@ static float oldOffsetX;
newCell = _pageCells[pageIndex+1];
}
//滑动过程中字体实时改变的大小
// 滑动过程中字体实时改变的大小
if (_pageTitleFontChangeType == PageTitleFontChangeTypeScrolling && _titleSelectedFont.pointSize != _titleFont.pointSize) {
CGFloat fontRuntimeDifferenceSize = xInScreen/kScreenWidth*(_titleSelectedFont.pointSize-_titleFont.pointSize);
......@@ -625,23 +625,23 @@ static float oldOffsetX;
}
// if (_pageTitleColorChangeType == PageTitleColorChangeTypeScrolling) {
// NSArray *rgba0 = [self getRGBValueFromColor:_titleColor];
// NSArray *rgba1 = [self getRGBValueFromColor:_titleSelectedColor];
// CGFloat diffR = xInScreen / kScreenWidth * ([rgba1[0] floatValue] - [rgba0[0] floatValue]);
// CGFloat diffG = xInScreen / kScreenWidth * ([rgba1[1] floatValue] - [rgba0[1] floatValue]);
// CGFloat diffB = xInScreen / kScreenWidth * ([rgba1[2] floatValue] - [rgba0[2] floatValue]);
// CGFloat runingRed0 = [rgba0[0] floatValue] + diffR;
// CGFloat runingGreen0 = [rgba0[1] floatValue] + diffG;
// CGFloat runingBlue0 = [rgba0[2] floatValue] + diffB;
// CGFloat runingred1 = [rgba1[0] floatValue] - diffR;
// CGFloat runinGreen1 = [rgba1[1] floatValue] - diffG;
// CGFloat runingBlue1 = [rgba1[2] floatValue] - diffB;
// UIColor *runtimeColor0 = [UIColor colorWithRed:runingRed0 green:runingGreen0 blue:runingBlue0 alpha:1.0];
// UIColor *runtimeColor1 = [UIColor colorWithRed:runingred1 green:runinGreen1 blue:runingBlue1 alpha:1.0];
// oldCell.titleLabel.textColor = runtimeColor1;
// newCell.titleLabel.textColor = runtimeColor0;
// }
// if (_pageTitleColorChangeType == PageTitleColorChangeTypeScrolling) {
// NSArray *rgba0 = [self getRGBValueFromColor:_titleColor];
// NSArray *rgba1 = [self getRGBValueFromColor:_titleSelectedColor];
// CGFloat diffR = xInScreen / kScreenWidth * ([rgba1[0] floatValue] - [rgba0[0] floatValue]);
// CGFloat diffG = xInScreen / kScreenWidth * ([rgba1[1] floatValue] - [rgba0[1] floatValue]);
// CGFloat diffB = xInScreen / kScreenWidth * ([rgba1[2] floatValue] - [rgba0[2] floatValue]);
// CGFloat runingRed0 = [rgba0[0] floatValue] + diffR;
// CGFloat runingGreen0 = [rgba0[1] floatValue] + diffG;
// CGFloat runingBlue0 = [rgba0[2] floatValue] + diffB;
// CGFloat runingred1 = [rgba1[0] floatValue] - diffR;
// CGFloat runinGreen1 = [rgba1[1] floatValue] - diffG;
// CGFloat runingBlue1 = [rgba1[2] floatValue] - diffB;
// UIColor *runtimeColor0 = [UIColor colorWithRed:runingRed0 green:runingGreen0 blue:runingBlue0 alpha:1.0];
// UIColor *runtimeColor1 = [UIColor colorWithRed:runingred1 green:runinGreen1 blue:runingBlue1 alpha:1.0];
// oldCell.titleLabel.textColor = runtimeColor1;
// newCell.titleLabel.textColor = runtimeColor0;
// }
}
/** 系统API获取UIColor的RGBA值 */
......@@ -658,8 +658,9 @@ static float oldOffsetX;
if (scrollView == _collectionMain) {
CGFloat x = scrollView.contentOffset.x ;
int index = (x + kScreenWidth*0.5) / kScreenWidth; //滑动切换基准选择: kScreenWidth*0.5(半屏)
CGFloat x = scrollView.contentOffset.x;
//滑动切换基准选择: kScreenWidth*0.5(半屏)
int index = (x + kScreenWidth*0.5) / kScreenWidth;
// ScrollViewPage 处理偏移:setContentOffset
[self updateCurrentScrollViewPageContentOffsetByIndex:index];
......@@ -681,9 +682,7 @@ static float oldOffsetX;
}
}];
}
}
}
/// 更新当前使用的分页ScrollView偏移量,复现UICollectionView滑动到view边缘处理的大致流程
......
......@@ -9,7 +9,5 @@
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow * window;
/// 选中的白噪音数据
@property (nonatomic, strong) NSArray *playList;
@end
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!