Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 496223a0
由
cgx
编写于
2022-07-05 23:04:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
绘制部分圆弧
1 个父辈
039cb2f3
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
332 行增加
和
119 行删除
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/UserInterfaceState.xcuserstate
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
DreamSleep/DreamSleep/Basement/Category/UIView+Extras.h
DreamSleep/DreamSleep/Basement/Category/UIView+Extras.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/BeizerView.h
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/BeizerView.m
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/ScoreLevelView.m
DreamSleep/Pods/Pods.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
DreamSleep/TapiOS/Unity-iPhone.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/UserInterfaceState.xcuserstate
查看文件 @
496223a
此文件类型无法预览
DreamSleep/DreamSleep.xcworkspace/xcuserdata/peter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
查看文件 @
496223a
...
@@ -16,5 +16,21 @@
...
@@ -16,5 +16,21 @@
stopOnStyle =
"0"
>
stopOnStyle =
"0"
>
</BreakpointContent>
</BreakpointContent>
</BreakpointProxy>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"D4B34AD0-00D5-4360-96E2-AEA2CAD80A2E"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"DreamSleep/Class/Start/Root/AppDelegate.m"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"138"
endingLineNumber =
"138"
landmarkName =
"-application:continueUserActivity:restorationHandler:"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Breakpoints>
</Bucket>
</Bucket>
DreamSleep/DreamSleep/Basement/Category/UIView+Extras.h
查看文件 @
496223a
...
@@ -55,5 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -55,5 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
UIView
*
)
genGradientWithStart
:(
CGPoint
)
start
end
:(
CGPoint
)
end
colors
:(
NSArray
*
)
colors
locations
:(
NSArray
*
)
locations
;
-
(
UIView
*
)
genGradientWithStart
:(
CGPoint
)
start
end
:(
CGPoint
)
end
colors
:(
NSArray
*
)
colors
locations
:(
NSArray
*
)
locations
;
// 截图
// 截图
-
(
UIImage
*
)
snapshotImage
;
-
(
UIImage
*
)
snapshotImage
;
-
(
UIImage
*
)
snapshotImage
:(
CGSize
)
size
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Basement/Category/UIView+Extras.m
查看文件 @
496223a
...
@@ -181,6 +181,19 @@
...
@@ -181,6 +181,19 @@
// 2.将控制器view的layer渲染到上下文
// 2.将控制器view的layer渲染到上下文
[
self
.
layer
renderInContext
:
UIGraphicsGetCurrentContext
()];
[
self
.
layer
renderInContext
:
UIGraphicsGetCurrentContext
()];
// 3.获取图片
// 3.获取图片
UIImage
*
snapshotImage
=
UIGraphicsGetImageFromCurrentImageContext
();
// 4.结束上下文
UIGraphicsEndImageContext
();
return
snapshotImage
;
}
-
(
UIImage
*
)
snapshotImage
:
(
CGSize
)
size
{
// 1.开启上下文
UIGraphicsBeginImageContextWithOptions
(
size
,
self
.
opaque
,
0
);
// 2.将控制器view的layer渲染到上下文
[
self
.
layer
renderInContext
:
UIGraphicsGetCurrentContext
()];
// 3.获取图片
UIImage
*
snapshotImage
=
UIGraphicsGetImageFromCurrentImageContext
();
UIImage
*
snapshotImage
=
UIGraphicsGetImageFromCurrentImageContext
();
// 4.结束上下文
// 4.结束上下文
UIGraphicsEndImageContext
();
UIGraphicsEndImageContext
();
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/BeizerView.h
查看文件 @
496223a
...
@@ -11,12 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -11,12 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 自定义贝塞尔曲线
/// 自定义贝塞尔曲线
@interface
BeizerView
:
UIView
@interface
BeizerView
:
UIView
@property
(
nonatomic
,
assign
)
float
progressRate
;
@property
(
nonatomic
,
assign
)
float
progressRate
;
@property
(
nonatomic
,
strong
)
UIColor
*
color
;
@property
(
nonatomic
,
assign
)
float
x
;
//cetner x
@property
(
nonatomic
,
assign
)
float
y
;
//center y
@property
(
nonatomic
,
assign
)
float
radius
;
//半径
@property
(
nonatomic
,
assign
)
float
startAngle
;
//起始位置
-
(
void
)
animateProgress
:(
float
)
progress
animate
:(
BOOL
)
animate
;
-
(
void
)
animateProgress
:(
float
)
progress
animate
:(
BOOL
)
animate
;
@end
@end
...
...
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/BeizerView.m
查看文件 @
496223a
...
@@ -8,104 +8,136 @@
...
@@ -8,104 +8,136 @@
#import "BeizerView.h"
#import "BeizerView.h"
@interface
BeizerView
()
@interface
BeizerView
()
@property
(
nonatomic
,
assign
)
float
step
;
@property
(
nonatomic
,
assign
)
float
step
;
@property
(
nonatomic
,
assign
)
float
total
;
@property
(
nonatomic
,
assign
)
float
total
;
@end
@end
@implementation
BeizerView
@implementation
BeizerView
-
(
void
)
drawRect
:(
CGRect
)
rect
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
CGFloat
x
=
-
self
.
width
,
y
=
-
self
.
height
,
width
=
2
*
self
.
width
,
height
=
2
*
self
.
height
,
startAngle
=
-
95
*
M_PI_2
/
90
.
0
,
endAngle
=
-
15
*
M_PI_2
/
90
.
0
;
self
.
backgroundColor
=
DSClearColor
;
}
return
self
;
}
CGContextRef
context
=
UIGraphicsGetCurrentContext
();
-
(
void
)
drawRect
:(
CGRect
)
rect
{
//设置填充颜色
CGFloat
x
=
0
,
y
=
0
,
width
=
self
.
width
,
height
=
self
.
height
;
CGContextSetFillColorWithColor
(
context
,
[
UIColor
redColor
].
CGColor
);
CGPoint
center
=
CGPointMake
(
x
+
width
/
2
.
0
,
y
+
height
/
2
.
0
);
//画椭圆,这里画的是个实心椭圆
//如果想画椭圆的边框,只需要把这句改为
CGContextStrokeEllipseInRect
(
context
,
CGRectMake
(
x
,
y
,
width
,
height
));
// CGContextFillEllipseInRect(context, CGRectMake(x, y, width, height));
CGContextSaveGState
(
context
);
CGFloat
startAngle
=
95
*
M_PI_2
/
90
;
//
CGFloat
endAngle
=
30
*
M_PI_2
/
90
;
// CGPoint center = CGPointMake(x + width / 2.0, y + height / 2.0);
CGFloat
diff
=
startAngle
-
endAngle
;
// UIBezierPath* clip = [UIBezierPath bezierPathWithArcCenter:center
CGFloat
endAngle2
=
startAngle
-
self
.
progressRate
*
diff
;
// radius:MAX(width, height)
// startAngle:startAngle
// 总曲线
// endAngle:endAngle
UIBezierPath
*
totalClip
=
[
UIBezierPath
bezierPathWithArcCenter
:
center
// clockwise:NO];
radius
:
MAX
(
width
,
height
)
// [clip addLineToPoint:center];
startAngle:
M_PI_2
// [clip closePath];
endAngle:
0
// [clip addClip];
clockwise:
NO
];
//
[
totalClip
addLineToPoint
:
center
];
// UIBezierPath *arc = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x, y, width, height)];
[
totalClip
closePath
];
// [[UIColor blackColor] setStroke];
[
totalClip
addClip
];
// [arc stroke];
UIBezierPath
*
totalArc
=
[
UIBezierPath
bezierPathWithOvalInRect
:
CGRectMake
(
x
,
y
,
width
,
height
)];
[[
UIColor
redColor
]
setStroke
];
[
totalArc
stroke
];
CGContextRestoreGState
(
context
);
// 当前曲线
UIBezierPath
*
curClip
=
[
UIBezierPath
bezierPathWithArcCenter
:
center
radius
:
MAX
(
width
,
height
)
startAngle:
startAngle
endAngle:
endAngle2
clockwise:
NO
];
[
curClip
addLineToPoint
:
center
];
[
curClip
closePath
];
[
curClip
addClip
];
UIBezierPath
*
curArc
=
[
UIBezierPath
bezierPathWithOvalInRect
:
CGRectMake
(
x
,
y
,
width
,
height
)];
[[
UIColor
greenColor
]
setStroke
];
[
curArc
stroke
];
// CGPoint center = CGPointMake(67, -508);
// if (self.tag == 1) {
// UIBezierPath *path = [UIBezierPath bezierPath];
// [path addArcWithCenter:center radius:600 startAngle:startAngle endAngle:-M_PI_2 clockwise:NO];
// CAShapeLayer *layer = [CAShapeLayer layer];
// layer.path = path.CGPath;
// layer.fillColor = [UIColor clearColor].CGColor;
// layer.strokeColor = [UIColor blueColor].CGColor;
// [self.layer addSublayer:layer];
// } else {
// UIBezierPath *path2 = [UIBezierPath bezierPath];
// [path2 addArcWithCenter:center radius:600 startAngle:startAngle endAngle:-M_PI_2 clockwise:NO];
// CAShapeLayer *layer2 = [CAShapeLayer layer];
// layer2.path = path2.CGPath;
// layer2.fillColor = [UIColor clearColor].CGColor;
// layer2.strokeColor = [UIColor greenColor].CGColor;
// [self.layer addSublayer:layer2];
// }
// 绘制总弧线
// 绘制总弧线
// UIBezierPath *aPath1 = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(-self.width, -self.height -2, 2*self.width + 2, 2*self.height + 2)];
// UIBezierPath *aPath1 = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(-self.width, -self.height -2, 2*self.width + 2, 2*self.height + 2)];
// aPath1.lineWidth = 2;
// aPath1.lineWidth = 2;
// aPath1.lineJoinStyle = kCGLineJoinRound;
// aPath1.lineJoinStyle = kCGLineJoinRound;
// [UIColor.blueColor set];
// [UIColor.blueColor set];
// [aPath1 stroke];
// [aPath1 stroke];
// [self debugViewShowBorder];
// [self debugViewShowBorder];
// 渐变色
// 渐变色
// CAGradientLayer *gradLayer = [CAGradientLayer layer];
// CAGradientLayer *gradLayer = [CAGradientLayer layer];
// gradLayer.frame = aPath1.bounds;
// gradLayer.frame = aPath1.bounds;
// gradLayer.colors = @[(__bridge id)ColorFromHex(0x9CE5EF).CGColor,(__bridge id)ColorFromHex(0x217B8B).CGColor];
// gradLayer.colors = @[(__bridge id)ColorFromHex(0x9CE5EF).CGColor,(__bridge id)ColorFromHex(0x217B8B).CGColor];
// gradLayer.startPoint = CGPointMake(0, .5);
// gradLayer.startPoint = CGPointMake(0, .5);
// gradLayer.endPoint = CGPointMake(1, .5);
// gradLayer.endPoint = CGPointMake(1, .5);
// gradLayer.locations = @[@0,@1.0];
// gradLayer.locations = @[@0,@1.0];
// gradLayer.type = kCAGradientLayerRadial;
// gradLayer.type = kCAGradientLayerRadial;
// [self.layer addSublayer:gradLayer];
// [self.layer addSublayer:gradLayer];
// 绘制当前弧线
// 绘制当前弧线
// UIBezierPath *aPath2=[UIBezierPath bezierPathWithOvalInRect:CGRectMake(-self.width, -self.height -2, 2*self.width + 2, 2*self.height + 2)];
// UIBezierPath *aPath2=[UIBezierPath bezierPathWithOvalInRect:CGRectMake(-self.width, -self.height -2, 2*self.width + 2, 2*self.height + 2)];
// aPath2.lineWidth = 2.0;
// aPath2.lineWidth = 2.0;
// [aPath2 stroke];
// [aPath2 stroke];
// self.clipsToBounds = YES;
// self.clipsToBounds = YES;
// UIBezierPath* aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(50, 0)
// UIBezierPath* aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(50, 0)
// radius:self.width
// radius:self.width
// startAngle:-75*M_PI_2/90
// startAngle:-75*M_PI_2/90
// endAngle:-55*M_PI_2/90
// endAngle:-55*M_PI_2/90
// clockwise:NO];
// clockwise:NO];
// aPath.lineWidth = 2.0;
// aPath.lineWidth = 2.0;
// aPath.lineCapStyle = kCGLineCapRound; //线条拐角
// aPath.lineCapStyle = kCGLineCapRound; //线条拐角
// aPath.lineJoinStyle = kCGLineJoinRound; //终点处理
// aPath.lineJoinStyle = kCGLineJoinRound; //终点处理
// [aPath stroke];
// [aPath stroke];
// self.clipsToBounds = YES;
// self.clipsToBounds = YES;
// [self debugViewShowBorder];
// [self debugViewShowBorder];
// 创建CAShapeLayer
// 创建CAShapeLayer
//
CAShapeLayer *layer = [CAShapeLayer layer];
//
CAShapeLayer *layer = [CAShapeLayer layer];
//
layer.fillColor = [UIColor clearColor].CGColor;
//
layer.fillColor = [UIColor clearColor].CGColor;
//
layer.lineWidth = 2.0f;
//
layer.lineWidth = 2.0f;
//
layer.lineCap = kCALineCapRound;
//
layer.lineCap = kCALineCapRound;
//
layer.lineJoin = kCALineJoinRound;
//
layer.lineJoin = kCALineJoinRound;
//
layer.strokeColor = [UIColor blueColor].CGColor;
//
layer.strokeColor = [UIColor blueColor].CGColor;
//
[self.layer addSublayer:layer];
//
[self.layer addSublayer:layer];
// layer.path = aPath
.CGPath;
// layer.path = curClip
.CGPath;
//
// 创建Animation
//
//
创建Animation
//
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
//
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
//
animation.fromValue = @(0.0);
//
animation.fromValue = @(0.0);
//
animation.toValue = @(1.0);
//
animation.toValue = @(1.0);
//
layer.autoreverses = NO;
//
layer.autoreverses = NO;
//
animation.duration = 4.0;
//
animation.duration = 4.0;
//
// 设置layer的animation
//
//
设置layer的animation
//
[layer addAnimation:animation forKey:nil];
//
[layer addAnimation:animation forKey:nil];
}
}
-
(
void
)
animateProgress
:(
float
)
progress
animate
:(
BOOL
)
animate
-
(
void
)
animateProgress
:(
float
)
progress
animate
:(
BOOL
)
animate
{
{
// _progressRate = progress;
if
(
animate
)
{
if
(
animate
)
{
self
.
total
=
progress
;
self
.
total
=
progress
;
/*
/*
...
@@ -116,7 +148,7 @@
...
@@ -116,7 +148,7 @@
selector:
@selector
(
numberAnimation
:
)
selector:
@selector
(
numberAnimation
:
)
userInfo:
nil
userInfo:
nil
repeats:
YES
];
repeats:
YES
];
}
else
{
}
else
{
[
self
setNeedsDisplay
];
[
self
setNeedsDisplay
];
}
}
}
}
...
@@ -130,7 +162,148 @@
...
@@ -130,7 +162,148 @@
return
;
return
;
}
}
self
.
progressRate
=
self
.
step
;
self
.
progressRate
=
self
.
step
;
DSLog
(
@"self.step:%f"
,
self
.
step
);
[
self
setNeedsDisplay
];
[
self
setNeedsDisplay
];
}
}
#pragma mark - others
-
(
void
)
addArc
:(
CGPoint
)
start
end
:(
CGPoint
)
end
angle
:(
double
)
angle
clockwise
:(
BOOL
)
clockwise
path
:(
UIBezierPath
*
)
path
{
if
(
!
((
start
.
x
!=
end
.
x
||
start
.
y
!=
end
.
y
)
&&
(
angle
>=
0
&&
angle
<=
2
*
M_PI
)))
{
return
;
}
if
(
angle
==
0
)
{
return
;
}
CGPoint
tmpStart
=
start
,
tmpEnd
=
end
;
double
tmpAngle
=
angle
;
// Note: 保证计算圆心时是从 start 到 end 顺时针 小于 π 的角
if
(
tmpAngle
>
M_PI
)
{
tmpAngle
=
2
*
M_PI
-
tmpAngle
;
CGPoint
tmpP
=
tmpStart
;
tmpStart
=
tmpEnd
;
tmpEnd
=
tmpP
;
}
if
(
!
clockwise
)
{
CGPoint
tmpP
=
tmpStart
;
tmpStart
=
tmpEnd
;
tmpEnd
=
tmpP
;
}
CGPoint
center
=
[
self
calculateCenterFor
:
tmpStart
end
:
tmpEnd
radian
:
tmpAngle
];
CGFloat
radius
=
[
self
calculateLineLength
:
start
p2
:
center
];
double
startAngle
=
[
self
calculateAngle
:
start
origin
:
center
];
double
endAngle
=
[
self
calculateAngle
:
end
origin
:
center
];
// Note: 逆时针绘制则交换 startAngle 和 endAngle,并且将开始点移动的 end 位置
if
(
!
clockwise
)
{
double
tmpAngle
=
startAngle
;
startAngle
=
endAngle
;
endAngle
=
tmpAngle
;
// [path moveToPoint:end];
}
[
path
addArcWithCenter
:
center
radius
:
radius
startAngle
:
startAngle
endAngle
:
endAngle
clockwise
:
clockwise
];
// [path moveToPoint:end];
}
// 计算2点间的距离
-
(
CGFloat
)
calculateLineLength
:(
CGPoint
)
p1
p2
:(
CGPoint
)
p2
{
CGFloat
w
=
p1
.
x
-
p2
.
x
;
CGFloat
h
=
p1
.
y
-
p2
.
y
;
return
sqrt
(
w
*
w
+
h
*
h
);
}
// 计算point和origin连接线在iOS坐标系的角度
-
(
double
)
calculateAngle
:(
CGPoint
)
point
origin
:(
CGPoint
)
origin
{
if
(
point
.
y
==
origin
.
y
)
{
return
point
.
x
>
origin
.
x
?
0
.
0
:
-
M_PI
;
}
if
(
point
.
x
==
origin
.
x
)
{
return
point
.
y
>
origin
.
y
?
M_PI
*
0
.
5
:
M_PI
*
-
0
.
5
;
}
// Note: 修正标准坐标系角度到 iOS 坐标系
double
rotationAdjustment
=
M_PI
*
0
.
5
;
double
offsetX
=
point
.
x
-
origin
.
x
;
double
offsetY
=
point
.
y
-
origin
.
y
;
// Note: 使用 -offsetY 是因为 iOS 坐标系与标准坐标系的区别
if
(
offsetY
>
0
)
{
return
floor
(
atan
(
offsetX
/
-
offsetY
))
+
rotationAdjustment
;
}
else
{
return
floor
(
atan
(
offsetX
/
-
offsetY
))
-
rotationAdjustment
;
}
}
// 计算圆心坐标
-
(
CGPoint
)
calculateCenterFor
:(
CGPoint
)
start
end
:(
CGPoint
)
end
radian
:(
double
)
radian
{
if
(
radian
>
M_PI
)
{
return
CGPointZero
;
}
if
(
start
.
x
==
end
.
x
&&
start
.
y
==
end
.
y
)
{
return
CGPointZero
;
}
if
(
radian
==
M_PI
)
{
double
centerX
=
(
end
.
x
-
start
.
x
)
*
0
.
5
+
start
.
x
;
double
centerY
=
(
end
.
y
-
start
.
y
)
*
0
.
5
+
start
.
y
;
return
CGPointMake
(
centerX
,
centerY
);
}
double
lineAB
=
[
self
calculateLineLength
:
start
p2
:
end
];
// 平行 Y 轴
if
(
start
.
x
==
end
.
x
)
{
double
centerY
=
(
end
.
y
-
start
.
y
)
*
0
.
5
+
start
.
y
;
double
tanResult
=
floor
(
tan
(
radian
*
0
.
5
));
double
offsetX
=
lineAB
*
0
.
5
/
tanResult
;
double
centerX
=
start
.
x
+
offsetX
*
(
start
.
y
>
end
.
y
?
1
.
0
:
-
1
.
0
);
return
CGPointMake
(
centerX
,
centerY
);
}
// 平行 X 轴
if
(
start
.
y
==
end
.
y
)
{
double
centerX
=
(
end
.
x
-
start
.
x
)
*
0
.
5
+
start
.
x
;
double
tanResult
=
floor
(
tan
(
radian
*
0
.
5
));
double
offsetY
=
lineAB
*
0
.
5
/
tanResult
;
double
centerY
=
start
.
y
+
offsetY
*
(
start
.
x
<
end
.
x
?
1
.
0
:
-
1
.
0
);
return
CGPointMake
(
centerX
,
centerY
);
}
// 普通情况
// 计算半径
double
radius
=
lineAB
*
0
.
5
/
floor
(
sin
(
radian
*
0
.
5
));
// 计算与 Y 轴的夹角
double
angleToYAxis
=
atan
(
fabs
(
start
.
x
-
end
.
x
)
/
fabs
(
start
.
y
-
end
.
y
));
double
cacluteAngle
=
floor
(
M_PI
-
radian
)
*
0
.
5
-
angleToYAxis
;
// 偏移量
double
offsetX
=
radius
*
sin
(
cacluteAngle
);
double
offsetY
=
radius
*
cos
(
cacluteAngle
);
double
centetX
=
end
.
x
;
double
centerY
=
end
.
y
;
// 以 start 为原点判断象限区间(iOS坐标系)
if
(
end
.
x
>
start
.
x
&&
end
.
y
<
start
.
y
)
{
// 第一象限
centetX
=
end
.
x
+
offsetX
;
centerY
=
end
.
y
+
offsetY
;
}
else
if
(
end
.
x
>
start
.
x
&&
end
.
y
>
start
.
y
)
{
// 第二象限
centetX
=
start
.
x
-
offsetX
;
centerY
=
start
.
y
+
offsetY
;
}
else
if
(
end
.
x
<
start
.
x
&&
end
.
y
>
start
.
y
)
{
// 第三象限
centetX
=
end
.
x
-
offsetX
;
centerY
=
end
.
y
-
offsetY
;
}
else
if
(
end
.
x
<
start
.
x
&&
end
.
y
<
start
.
y
)
{
// 第四象限
centetX
=
start
.
x
+
offsetX
;
centerY
=
start
.
y
-
offsetY
;
}
return
CGPointMake
(
centetX
,
centerY
);
}
@end
@end
DreamSleep/DreamSleep/Class/ProfileModule/ScoreTaskAI/View/ScoreLevelView.m
查看文件 @
496223a
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
@property
(
nonatomic
,
strong
)
UIButton
*
rulesBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
rulesBtn
;
@property
(
nonatomic
,
strong
)
UILabel
*
curRankLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
curRankLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
nextRankLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
nextRankLab
;
@property
(
nonatomic
,
strong
)
BeizerView
*
b
eizerView
;
@property
(
nonatomic
,
strong
)
BeizerView
*
arcB
eizerView
;
@property
(
nonatomic
,
strong
)
ScoreRulesView
*
scoreRulesView
;
@property
(
nonatomic
,
strong
)
ScoreRulesView
*
scoreRulesView
;
@property
(
nonatomic
,
strong
)
NSArray
*
rulesArr
;
@property
(
nonatomic
,
strong
)
NSArray
*
rulesArr
;
@end
@end
...
@@ -30,10 +30,10 @@
...
@@ -30,10 +30,10 @@
[
self
addSubview
:
self
.
curRankNameLab
];
[
self
addSubview
:
self
.
curRankNameLab
];
[
self
addSubview
:
self
.
totalPointsLab
];
[
self
addSubview
:
self
.
totalPointsLab
];
[
self
addSubview
:
self
.
rewardIV
];
[
self
addSubview
:
self
.
rewardIV
];
[
self
addSubview
:
self
.
rulesBtn
];
[
self
addSubview
:
self
.
curRankLab
];
[
self
addSubview
:
self
.
curRankLab
];
[
self
addSubview
:
self
.
nextRankLab
];
[
self
addSubview
:
self
.
nextRankLab
];
[
self
addSubview
:
self
.
beizerView
];
[
self
addSubview
:
self
.
arcBeizerView
];
[
self
addSubview
:
self
.
rulesBtn
];
CGFloat
h
=
150
*
(
kScreenWidth
-
30
)
/
345
;
CGFloat
h
=
150
*
(
kScreenWidth
-
30
)
/
345
;
[
self
.
cardIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
cardIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
...
@@ -52,11 +52,29 @@
...
@@ -52,11 +52,29 @@
make
.
right
.
equalTo
(
self
.
cardIV
).
offset
(
-
9
);
make
.
right
.
equalTo
(
self
.
cardIV
).
offset
(
-
9
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
64
,
21
));
make
.
size
.
mas_equalTo
(
CGSizeMake
(
64
,
21
));
}];
}];
[
self
.
beizerView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
arcBeizerView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
right
.
equalTo
(
self
.
cardIV
);
make
.
right
.
equalTo
(
self
.
cardIV
);
make
.
left
.
equalTo
(
self
.
cardIV
).
offset
(
-
self
.
cardIV
.
width
);
make
.
bottom
.
equalTo
(
self
.
cardIV
).
offset
(
-
36
);
make
.
bottom
.
equalTo
(
self
.
cardIV
).
offset
(
-
36
);
make
.
top
.
equalTo
(
self
.
cardIV
).
offset
(
38
);
make
.
top
.
equalTo
(
self
.
cardIV
).
offset
(
-
38
);
}];
}];
// 截图方法
// [self.curBeizerView mas_makeConstraints:^(MASConstraintMaker *make) {
// // make.left.top.bottom.right.equalTo(self.totalBeizerView);
// make.left.top.bottom.equalTo(self.totalBeizerView);
// make.right.equalTo(self.totalBeizerView).offset(-100);
// }];
// [self.curBeizerView layoutIfNeeded];
// UIImage *imge = [self.curBeizerView snapshotImage:CGSizeMake(200, self.curBeizerView.height)];
// UIImageView *iv = [UIImageView new];
// iv.image = imge;
// iv.backgroundColor = DSClearColor;
// [self addSubview:iv];
// [iv mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.left.bottom.equalTo(self.totalBeizerView);
// make.width.equalTo(@200);
// }];
// self.curBeizerView.hidden = YES;
}
}
return
self
;
return
self
;
}
}
...
@@ -69,7 +87,9 @@
...
@@ -69,7 +87,9 @@
[
self
.
rewardIV
yy_setImageWithURL
:[
NSURL
URLWithString
:
scoreModel
.
reward_img
]
placeholder
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
[
self
.
rewardIV
yy_setImageWithURL
:[
NSURL
URLWithString
:
scoreModel
.
reward_img
]
placeholder
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
self
.
curRankLab
.
text
=
scoreModel
.
cur_rank
;
self
.
curRankLab
.
text
=
scoreModel
.
cur_rank
;
self
.
nextRankLab
.
text
=
scoreModel
.
next_rank
;
self
.
nextRankLab
.
text
=
scoreModel
.
next_rank
;
[
self
.
beizerView
animateProgress
:.
8
animate
:
YES
];
double
progress
=
(
double
)
scoreModel
.
total_points
/
(
double
)
scoreModel
.
next_min_point
;
DSLog
(
@"progress:%f"
,
progress
);
[
self
.
arcBeizerView
animateProgress
:
1
.
0
animate
:
YES
];
[
self
.
curRankNameLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
curRankNameLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
cardIV
).
offset
(
20
);
make
.
left
.
equalTo
(
self
.
cardIV
).
offset
(
20
);
...
@@ -146,17 +166,11 @@
...
@@ -146,17 +166,11 @@
return
_nextRankLab
;
return
_nextRankLab
;
}
}
-
(
BeizerView
*
)
beizerView
{
-
(
BeizerView
*
)
arcBeizerView
{
if
(
!
_beizerView
)
{
if
(
!
_arcBeizerView
)
{
_beizerView
=
[[
BeizerView
alloc
]
initWithFrame
:
CGRectZero
];
_arcBeizerView
=
[
BeizerView
new
];
_beizerView
.
x
=
50
;
_beizerView
.
y
=
50
;
// _beizerView.radius = 40;
_beizerView
.
backgroundColor
=
DSClearColor
;
// [_beizerView debugViewShowBorder];
// _beizerView.layer.anchorPoint = CGPointMake(0.5, 0.5);
}
}
return
_
b
eizerView
;
return
_
arcB
eizerView
;
}
}
-
(
ScoreRulesView
*
)
scoreRulesView
{
-
(
ScoreRulesView
*
)
scoreRulesView
{
...
...
DreamSleep/Pods/Pods.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
查看文件 @
496223a
...
@@ -7,77 +7,77 @@
...
@@ -7,77 +7,77 @@
<key>
AFNetworking.xcscheme_^#shared#^_
</key>
<key>
AFNetworking.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
8
</integer>
<integer>
9
</integer>
</dict>
</dict>
<key>
DKNightVersion.xcscheme_^#shared#^_
</key>
<key>
DKNightVersion.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
0
</integer>
<integer>
1
2
</integer>
</dict>
</dict>
<key>
DOUAudioStreamer.xcscheme_^#shared#^_
</key>
<key>
DOUAudioStreamer.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
2
</integer>
<integer>
1
9
</integer>
</dict>
</dict>
<key>
FreeStreamer.xcscheme_^#shared#^_
</key>
<key>
FreeStreamer.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
7
</integer>
<integer>
1
5
</integer>
</dict>
</dict>
<key>
IQKeyboardManager.xcscheme_^#shared#^_
</key>
<key>
IQKeyboardManager.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
5
</integer>
<integer>
4
</integer>
</dict>
</dict>
<key>
MBProgressHUD.xcscheme_^#shared#^_
</key>
<key>
MBProgressHUD.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
9
</integer>
<integer>
8
</integer>
</dict>
</dict>
<key>
MJRefresh.xcscheme_^#shared#^_
</key>
<key>
MJRefresh.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
13
</integer>
<integer>
7
</integer>
</dict>
</dict>
<key>
Masonry.xcscheme_^#shared#^_
</key>
<key>
Masonry.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
18
</integer>
<integer>
6
</integer>
</dict>
</dict>
<key>
Pods-DreamSleep.xcscheme_^#shared#^_
</key>
<key>
Pods-DreamSleep.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
4
</integer>
<integer>
16
</integer>
</dict>
</dict>
<key>
Reachability.xcscheme_^#shared#^_
</key>
<key>
Reachability.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
7
</integer>
<integer>
10
</integer>
</dict>
</dict>
<key>
YYCache.xcscheme_^#shared#^_
</key>
<key>
YYCache.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
5
</integer>
<integer>
1
1
</integer>
</dict>
</dict>
<key>
YYImage.xcscheme_^#shared#^_
</key>
<key>
YYImage.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
4
</integer>
<integer>
1
3
</integer>
</dict>
</dict>
<key>
YYModel.xcscheme_^#shared#^_
</key>
<key>
YYModel.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
6
</integer>
<integer>
1
8
</integer>
</dict>
</dict>
<key>
YYWebImage.xcscheme_^#shared#^_
</key>
<key>
YYWebImage.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
1
9
</integer>
<integer>
1
7
</integer>
</dict>
</dict>
<key>
lottie-ios.xcscheme_^#shared#^_
</key>
<key>
lottie-ios.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
11
</integer>
<integer>
5
</integer>
</dict>
</dict>
</dict>
</dict>
</dict>
</dict>
...
...
DreamSleep/TapiOS/Unity-iPhone.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist
查看文件 @
496223a
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<key>
UnityFramework.xcscheme_^#shared#^_
</key>
<key>
UnityFramework.xcscheme_^#shared#^_
</key>
<dict>
<dict>
<key>
orderHint
</key>
<key>
orderHint
</key>
<integer>
6
</integer>
<integer>
14
</integer>
</dict>
</dict>
</dict>
</dict>
</dict>
</dict>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论