@@ -415,7 +415,7 @@ -(void)setViewLayoutCompleteBlock:(void (^)(MyBaseLayout *, UIView *))viewLayout
415
415
-(CGRect )estimatedRect
416
416
{
417
417
CGRect rect = self.myFrame .frame ;
418
- if (rect.size .width == CGFLOAT_MAX || rect.size .width == CGFLOAT_MAX)
418
+ if (rect.size .width == CGFLOAT_MAX || rect.size .height == CGFLOAT_MAX)
419
419
return self.frame ;
420
420
return rect;
421
421
}
@@ -1087,6 +1087,11 @@ -(BOOL)hideSubviewReLayout
1087
1087
return NO ;
1088
1088
}
1089
1089
1090
+ -(void )removeAllSubviews
1091
+ {
1092
+ [self .subviews makeObjectsPerformSelector: @selector (removeFromSuperview )];
1093
+ }
1094
+
1090
1095
1091
1096
-(void )layoutAnimationWithDuration : (NSTimeInterval )duration
1092
1097
{
@@ -2086,13 +2091,13 @@ -(MyGravity)myGetSubviewVertGravity:(UIView*)sbv sbvsc:(UIView*)sbvsc vertGravit
2086
2091
sbvVertGravity = sbvVertAligement;
2087
2092
}
2088
2093
2089
- if (sbvsc.centerYPosInner .posVal != nil )
2094
+ if (sbvsc.topPosInner . posVal != nil && sbvsc. bottomPosInner .posVal != nil )
2090
2095
{
2091
- sbvVertGravity = MyGravity_Vert_Center ;
2096
+ sbvVertGravity = MyGravity_Vert_Fill ;
2092
2097
}
2093
- else if (sbvsc.topPosInner . posVal != nil && sbvsc. bottomPosInner .posVal != nil )
2098
+ else if (sbvsc.centerYPosInner .posVal != nil )
2094
2099
{
2095
- sbvVertGravity = MyGravity_Vert_Fill ;
2100
+ sbvVertGravity = MyGravity_Vert_Center ;
2096
2101
}
2097
2102
else if (sbvsc.topPosInner .posVal != nil )
2098
2103
{
@@ -2180,13 +2185,13 @@ -(MyGravity)myGetSubviewHorzGravity:(UIView*)sbv sbvsc:(UIView*)sbvsc horzGravit
2180
2185
sbvHorzGravity = sbvHorzAligement;
2181
2186
}
2182
2187
2183
- if (sbvsc.centerXPosInner .posVal != nil )
2188
+ if (sbvsc.leadingPosInner . posVal != nil && sbvsc. trailingPosInner .posVal != nil )
2184
2189
{
2185
- sbvHorzGravity = MyGravity_Horz_Center ;
2190
+ sbvHorzGravity = MyGravity_Horz_Fill ;
2186
2191
}
2187
- else if (sbvsc.leadingPosInner . posVal != nil && sbvsc. trailingPosInner .posVal != nil )
2192
+ else if (sbvsc.centerXPosInner .posVal != nil )
2188
2193
{
2189
- sbvHorzGravity = MyGravity_Horz_Fill ;
2194
+ sbvHorzGravity = MyGravity_Horz_Center ;
2190
2195
}
2191
2196
else if (sbvsc.leadingPosInner .posVal != nil )
2192
2197
{
@@ -3210,7 +3215,7 @@ -(void)setTopBorderline:(MyBorderline *)topBorderline
3210
3215
_topBorderline = topBorderline;
3211
3216
3212
3217
CAShapeLayer *borderLayer = _topBorderlineLayer;
3213
- [self myUpdateBorderLayer : &borderLayer withBorderline: _topBorderline];
3218
+ [self updateBorderLayer : &borderLayer withBorderline: _topBorderline];
3214
3219
_topBorderlineLayer = borderLayer;
3215
3220
3216
3221
}
@@ -3223,7 +3228,7 @@ -(void)setLeadingBorderline:(MyBorderline *)leadingBorderline
3223
3228
_leadingBorderline = leadingBorderline;
3224
3229
3225
3230
CAShapeLayer *borderLayer = _leadingBorderlineLayer;
3226
- [self myUpdateBorderLayer : &borderLayer withBorderline: _leadingBorderline];
3231
+ [self updateBorderLayer : &borderLayer withBorderline: _leadingBorderline];
3227
3232
_leadingBorderlineLayer = borderLayer;
3228
3233
}
3229
3234
}
@@ -3235,7 +3240,7 @@ -(void)setBottomBorderline:(MyBorderline *)bottomBorderline
3235
3240
_bottomBorderline = bottomBorderline;
3236
3241
3237
3242
CAShapeLayer *borderLayer = _bottomBorderlineLayer;
3238
- [self myUpdateBorderLayer : &borderLayer withBorderline: _bottomBorderline];
3243
+ [self updateBorderLayer : &borderLayer withBorderline: _bottomBorderline];
3239
3244
_bottomBorderlineLayer = borderLayer;
3240
3245
}
3241
3246
}
@@ -3248,7 +3253,7 @@ -(void)setTrailingBorderline:(MyBorderline *)trailingBorderline
3248
3253
_trailingBorderline = trailingBorderline;
3249
3254
3250
3255
CAShapeLayer *borderLayer = _trailingBorderlineLayer;
3251
- [self myUpdateBorderLayer : &borderLayer withBorderline: _trailingBorderline];
3256
+ [self updateBorderLayer : &borderLayer withBorderline: _trailingBorderline];
3252
3257
_trailingBorderlineLayer = borderLayer;
3253
3258
}
3254
3259
@@ -3289,7 +3294,7 @@ -(void)setRightBorderline:(MyBorderline *)rightBorderline
3289
3294
3290
3295
3291
3296
3292
- -(void )myUpdateBorderLayer : (CAShapeLayer **)ppLayer withBorderline : (MyBorderline*)borderline
3297
+ -(void )updateBorderLayer : (CAShapeLayer **)ppLayer withBorderline : (MyBorderline*)borderline
3293
3298
{
3294
3299
3295
3300
if (borderline == nil )
@@ -3526,6 +3531,24 @@ BOOL _myCGFloatNotEqual(CGFloat f1, CGFloat f2)
3526
3531
#endif
3527
3532
}
3528
3533
3534
+ BOOL _myCGFloatLess (CGFloat f1, CGFloat f2)
3535
+ {
3536
+ #if CGFLOAT_IS_DOUBLE == 1
3537
+ return f2 - f1 > 1e-7 ;
3538
+ #else
3539
+ return f2 - f1 > 1e-4 ;
3540
+ #endif
3541
+
3542
+ }
3543
+
3544
+ BOOL _myCGFloatGreat (CGFloat f1, CGFloat f2)
3545
+ {
3546
+ #if CGFLOAT_IS_DOUBLE == 1
3547
+ return f1 - f2 > 1e-7 ;
3548
+ #else
3549
+ return f1 - f2 > 1e-4 ;
3550
+ #endif
3551
+ }
3529
3552
3530
3553
BOOL _myCGFloatLessOrEqual (CGFloat f1, CGFloat f2)
3531
3554
{
@@ -3567,8 +3590,8 @@ CGFloat _myRoundNumber(CGFloat f)
3567
3590
if (f == 0 || f == CGFLOAT_MAX || f == -CGFLOAT_MAX)
3568
3591
return f;
3569
3592
3570
- int fi = ( int )f ;
3571
- if (f == fi )
3593
+ int fi = round (f) ;
3594
+ if (_myCGFloatEqual (f, fi) )
3572
3595
return fi;
3573
3596
3574
3597
// 按精度四舍五入
0 commit comments