Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8afb9f55
由
cgx
编写于
2022-04-15 10:27:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
均衡舒压和舒睡新增提示文案
1 个父辈
6666520c
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
125 行增加
和
9 行删除
DreamSleep/DreamSleep/AISleepCoach/AISleepCoachController.m
DreamSleep/DreamSleep/Category/NSString+Extras.h
DreamSleep/DreamSleep/Category/NSString+Extras.m
DreamSleep/DreamSleep/Category/UILabel+Extras.h
DreamSleep/DreamSleep/Category/UILabel+Extras.m
DreamSleep/DreamSleep/Category/UIView+Extras.h
DreamSleep/DreamSleep/Category/UIView+Extras.m
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreathTextView.h
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreathTextView.m
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreatheController.h
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreatheController.m
DreamSleep/DreamSleep/Utils/PrefixHeader.pch
DreamSleep/DreamSleep/AISleepCoach/AISleepCoachController.m
查看文件 @
8afb9f5
...
@@ -107,7 +107,6 @@
...
@@ -107,7 +107,6 @@
_aiWebView
.
backgroundColor
=
DSWhite
;
_aiWebView
.
backgroundColor
=
DSWhite
;
_aiWebView
.
UIDelegate
=
self
;
_aiWebView
.
UIDelegate
=
self
;
[
_aiWebView
addObserver
:
self
forKeyPath
:
@"estimatedProgress"
options
:
NSKeyValueObservingOptionNew
context
:
nil
];
[
_aiWebView
addObserver
:
self
forKeyPath
:
@"estimatedProgress"
options
:
NSKeyValueObservingOptionNew
context
:
nil
];
_aiWebView
.
navigationDelegate
=
self
;
_aiWebView
.
navigationDelegate
=
self
;
_aiWebView
.
scrollView
.
showsVerticalScrollIndicator
=
NO
;
_aiWebView
.
scrollView
.
showsVerticalScrollIndicator
=
NO
;
...
...
DreamSleep/DreamSleep/Category/NSString+Extras.h
0 → 100644
查看文件 @
8afb9f5
//
// NSString+Extras.h
// DreamSleep
//
// Created by peter on 2022/4/15.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface
NSString
(
Extras
)
/**
* @brief 根据字符串属性获取控件高度
* @param text 传入的文本信息
* @param font 字体
* @param maxWidth 最大宽度
* @return height
*/
+
(
CGFloat
)
getHeightWithText
:(
NSString
*
)
text
withFont
:(
UIFont
*
)
font
withMaxWidth
:(
CGFloat
)
maxWidth
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Category/NSString+Extras.m
0 → 100644
查看文件 @
8afb9f5
//
// NSString+Extras.m
// DreamSleep
//
// Created by peter on 2022/4/15.
//
#import "NSString+Extras.h"
@implementation
NSString
(
Extras
)
+
(
CGFloat
)
getHeightWithText
:(
NSString
*
)
text
withFont
:(
UIFont
*
)
font
withMaxWidth
:(
CGFloat
)
maxWidth
{
NSDictionary
*
strAttributes
=
@{
NSFontAttributeName
:
font
,
NSForegroundColorAttributeName
:
MainTextColor
};
CGSize
size
=
[
text
boundingRectWithSize
:
CGSizeMake
(
maxWidth
,
MAXFLOAT
)
options
:
NSStringDrawingUsesLineFragmentOrigin
attributes
:
strAttributes
context
:
nil
].
size
;
return
size
.
height
;
}
@end
DreamSleep/DreamSleep/Category/UILabel+Extras.h
查看文件 @
8afb9f5
...
@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
+
(
UILabel
*
)
dkLabWithFont
:(
UIFont
*
)
font
;
+
(
UILabel
*
)
dkLabWithFont
:(
UIFont
*
)
font
;
+
(
UILabel
*
)
labWithTextColor
:(
UIColor
*
)
textColor
font
:(
UIFont
*
)
font
;
+
(
UILabel
*
)
labWithTextColor
:(
UIColor
*
)
textColor
font
:(
UIFont
*
)
font
;
+
(
UILabel
*
)
labWithText
:(
NSString
*
)
text
textColor
:(
UIColor
*
)
textColor
font
:(
UIFont
*
)
font
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Category/UILabel+Extras.m
查看文件 @
8afb9f5
...
@@ -32,4 +32,12 @@
...
@@ -32,4 +32,12 @@
return
lab
;
return
lab
;
}
}
+
(
UILabel
*
)
labWithText
:(
NSString
*
)
text
textColor
:(
UIColor
*
)
textColor
font
:(
UIFont
*
)
font
{
UILabel
*
lab
=
[
UILabel
new
];
lab
.
font
=
font
;
lab
.
text
=
text
;
lab
.
textColor
=
textColor
;
return
lab
;
}
@end
@end
DreamSleep/DreamSleep/Category/UIView+Extras.h
查看文件 @
8afb9f5
...
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@property
CGFloat
width
;
@property
CGFloat
width
;
@property
CGFloat
x
;
@property
CGFloat
x
;
@property
CGFloat
y
;
@property
CGFloat
y
;
@property
CGPoint
origin
;
/**
/**
根据view获取UIViewController(该view必须完成初始化)
根据view获取UIViewController(该view必须完成初始化)
...
...
DreamSleep/DreamSleep/Category/UIView+Extras.m
查看文件 @
8afb9f5
...
@@ -49,6 +49,10 @@
...
@@ -49,6 +49,10 @@
self
.
frame
=
rect
;
self
.
frame
=
rect
;
}
}
-
(
CGPoint
)
origin
{
return
self
.
frame
.
origin
;
}
-
(
UIViewController
*
)
ds_viewController
{
-
(
UIViewController
*
)
ds_viewController
{
for
(
UIView
*
next
=
[
self
superview
];
next
;
next
=
next
.
superview
)
{
for
(
UIView
*
next
=
[
self
superview
];
next
;
next
=
next
.
superview
)
{
UIResponder
*
nextResponder
=
[
next
nextResponder
];
UIResponder
*
nextResponder
=
[
next
nextResponder
];
...
...
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreathTextView.h
0 → 100644
查看文件 @
8afb9f5
//
// BreathTextView.h
// DreamSleep
//
// Created by peter on 2022/4/15.
//
typedef
NS_ENUM
(
NSInteger
,
LottieStyle
)
{
// 均衡呼吸法
LottieStyleBalance
,
// 舒睡呼吸法
LottieStyleComfortable
};
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 文本显示区域(新增)
@interface
BreathTextView
:
UIView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
style
:(
LottieStyle
)
style
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreathTextView.m
0 → 100644
查看文件 @
8afb9f5
//
// BreathTextView.m
// DreamSleep
//
// Created by peter on 2022/4/15.
//
#import "BreathTextView.h"
@implementation
BreathTextView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
style
:(
LottieStyle
)
style
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
NSString
*
text
=
style
==
LottieStyleBalance
?
@"适用于平复情绪,缓解压力
\n\n
• 鼻吸气4秒
\n\n
• 嘴吐气7秒"
:
@"每天睡前使用2分钟,放松身心快速入睡
\n\n
• 鼻吸气4秒
\n\n
• 憋气7秒
\n\n
• 嘴吐气8秒"
;
CGFloat
height
=
[
NSString
getHeightWithText
:
text
withFont
:
SysFont
(
14
.
0
)
withMaxWidth
:
self
.
width
];
UILabel
*
lab
=
[
UILabel
labWithText
:
text
textColor
:
ColorFromHex
(
0x5A6073
)
font
:
SysFont
(
14
.
0
)];
lab
.
numberOfLines
=
0
;
lab
.
textAlignment
=
NSTextAlignmentCenter
;
lab
.
frame
=
CGRectMake
(
0
,
0
,
self
.
width
,
height
);
[
self
addSubview
:
lab
];
self
.
height
=
height
;
}
return
self
;
}
@end
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreatheController.h
查看文件 @
8afb9f5
...
@@ -6,16 +6,10 @@
...
@@ -6,16 +6,10 @@
//
//
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "BreathTextView.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
typedef
NS_ENUM
(
NSInteger
,
LottieStyle
)
{
// 均衡呼吸法
LottieStyleBalance
,
// 舒睡呼吸法
LottieStyleComfortable
};
/// 均衡呼吸法和舒睡4-7-8呼吸法
/// 均衡呼吸法和舒睡4-7-8呼吸法
@interface
BreatheController
:
UIViewController
@interface
BreatheController
:
UIViewController
// 动画样式
// 动画样式
...
...
DreamSleep/DreamSleep/HomeModule/BreathingMethod/BreatheController.m
查看文件 @
8afb9f5
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
#import <AudioToolbox/AudioToolbox.h>
#import <AudioToolbox/AudioToolbox.h>
@interface
BreatheController
()
<
UIPickerViewDataSource
,
UIPickerViewDelegate
>
@interface
BreatheController
()
<
UIPickerViewDataSource
,
UIPickerViewDelegate
>
// 文字显示区
@property
(
nonatomic
,
strong
)
BreathTextView
*
breathTextView
;
// 旋转lottie
// 旋转lottie
@property
(
nonatomic
,
strong
)
LOTAnimationView
*
rotateView
;
@property
(
nonatomic
,
strong
)
LOTAnimationView
*
rotateView
;
// 缩放lottie
// 缩放lottie
...
@@ -84,6 +86,7 @@
...
@@ -84,6 +86,7 @@
}
}
-
(
void
)
initView
{
-
(
void
)
initView
{
[
self
.
view
addSubview
:
self
.
breathTextView
];
[
self
.
view
addSubview
:
self
.
rotateView
];
[
self
.
view
addSubview
:
self
.
rotateView
];
[
self
.
view
addSubview
:
self
.
zoomView
];
[
self
.
view
addSubview
:
self
.
zoomView
];
[
self
.
view
addSubview
:
self
.
minutePickerView
];
[
self
.
view
addSubview
:
self
.
minutePickerView
];
...
@@ -107,7 +110,7 @@
...
@@ -107,7 +110,7 @@
[
self
.
rotateView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
rotateView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
width
.
height
.
equalTo
(
@162
);
make
.
width
.
height
.
equalTo
(
@162
);
make
.
centerX
.
equalTo
(
self
.
view
);
make
.
centerX
.
equalTo
(
self
.
view
);
make
.
topMargin
.
equalTo
(
self
.
view
).
offset
(
100
);
make
.
topMargin
.
equalTo
(
self
.
breathTextView
.
mas_bottom
).
offset
(
41
);
}];
}];
[
self
.
zoomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
zoomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
view
);
make
.
center
.
equalTo
(
self
.
view
);
...
@@ -150,6 +153,7 @@
...
@@ -150,6 +153,7 @@
#pragma mark - Action
#pragma mark - Action
-
(
void
)
startRelaxAction
:
(
UIButton
*
)
sender
{
-
(
void
)
startRelaxAction
:
(
UIButton
*
)
sender
{
sender
.
selected
=
!
sender
.
selected
;
sender
.
selected
=
!
sender
.
selected
;
self
.
breathTextView
.
hidden
=
YES
;
self
.
rotateView
.
hidden
=
YES
;
self
.
rotateView
.
hidden
=
YES
;
self
.
timeLb
.
hidden
=
YES
;
self
.
timeLb
.
hidden
=
YES
;
self
.
minuteLb
.
hidden
=
YES
;
self
.
minuteLb
.
hidden
=
YES
;
...
@@ -257,6 +261,13 @@
...
@@ -257,6 +261,13 @@
return
attributedString
;
return
attributedString
;
}
}
-
(
BreathTextView
*
)
breathTextView
{
if
(
!
_breathTextView
)
{
_breathTextView
=
[[
BreathTextView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
kTopHeight
(
0
)
+
61
,
kScreenWidth
,
100
)
style
:
self
.
style
];
}
return
_breathTextView
;
}
-
(
LOTAnimationView
*
)
rotateView
{
-
(
LOTAnimationView
*
)
rotateView
{
if
(
!
_rotateView
)
{
if
(
!
_rotateView
)
{
_rotateView
=
[
LOTAnimationView
animationNamed
:
self
.
rotateLottieFile
];
_rotateView
=
[
LOTAnimationView
animationNamed
:
self
.
rotateLottieFile
];
...
...
DreamSleep/DreamSleep/Utils/PrefixHeader.pch
查看文件 @
8afb9f5
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#import "UIView+Extras.h"
#import "UIView+Extras.h"
#import "UILabel+Extras.h"
#import "UILabel+Extras.h"
#import "UIButton+Extras.h"
#import "UIButton+Extras.h"
#import "NSString+Extras.h"
#import "NaviBarHandlerProtocol.h"
#import "NaviBarHandlerProtocol.h"
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论