You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/04/11 03:15:11 UTC
[09/10] incubator-weex git commit: * [ios] fix bug box shadow color
and headerToIndexTable
* [ios] fix bug box shadow color and headerToIndexTable
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/00b03746
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/00b03746
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/00b03746
Branch: refs/heads/dev
Commit: 00b03746e7a661420e420765e87e2e049a6db24d
Parents: 7a85b8a
Author: \u9f50\u5c71 <su...@163.com>
Authored: Mon Apr 10 21:07:38 2017 +0800
Committer: \u9f50\u5c71 <su...@163.com>
Committed: Mon Apr 10 21:07:38 2017 +0800
----------------------------------------------------------------------
.../Component/Recycler/WXRecyclerDataController.m | 2 +-
.../Sources/Display/WXComponent+BoxShadow.h | 2 +-
.../Sources/Display/WXComponent+BoxShadow.m | 10 +++++-----
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h | 2 +-
ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m | 4 ++--
.../WeexSDK/Sources/Layout/WXComponent+Layout.m | 2 +-
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h | 2 +-
ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m | 18 ++----------------
8 files changed, 14 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
index 92875ce..ed02863 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.m
@@ -15,7 +15,7 @@
@property (nonatomic, strong, readwrite) NSArray<WXSectionDataController *> *sections;
@property (nonatomic, strong, readonly) NSMapTable<WXCellComponent *, NSIndexPath*> *cellToIndexPathTable;
-@property (nonatomic, strong, readonly) NSMapTable<WXCellComponent *, NSIndexPath*> *headerToIndexTable;
+@property (nonatomic, strong, readonly) NSMapTable<WXHeaderComponent *, NSNumber*> *headerToIndexTable;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.h b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.h
index 2c1a645..d7fe12e 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.h
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.h
@@ -21,7 +21,7 @@
*
* @return if not equal return NO, if equal return YES
*/
-- (BOOL)EqualBoxShadow:(WXBoxShadow *_Nullable)boxShadow withBoxShadow:(WXBoxShadow *_Nullable)compareBoxShadow;
+- (BOOL)equalBoxShadow:(WXBoxShadow *_Nullable)boxShadow withBoxShadow:(WXBoxShadow *_Nullable)compareBoxShadow;
/**
* @abstract config view Layer with boxshadow, lastboxshadow and originalBoxShadow
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
index ba9927b..bbbf764 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
@@ -18,7 +18,7 @@
- (WXBoxShadow *_Nullable)getViewBoxShadow:(UIView *_Nullable)view
{
WXBoxShadow *boxShadow = [WXBoxShadow new];
- boxShadow.shadowColor = view.layer.shadowColor;
+ boxShadow.shadowColor = [UIColor colorWithCGColor:view.layer.shadowColor];
boxShadow.shadowOffset = view.layer.shadowOffset;
boxShadow.shadowRadius = view.layer.shadowRadius;
boxShadow.shadowOpacity = view.layer.shadowOpacity;
@@ -29,7 +29,7 @@
{
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds];
self.view.layer.masksToBounds = NO;
- self.view.layer.shadowColor = _originalBoxShadow.shadowColor;
+ self.view.layer.shadowColor = _originalBoxShadow.shadowColor.CGColor;
self.view.layer.shadowOffset = _originalBoxShadow.shadowOffset;
self.view.layer.shadowRadius = _originalBoxShadow.shadowRadius;
self.view.layer.shadowOpacity = _originalBoxShadow.shadowOpacity;
@@ -44,11 +44,11 @@
}
// if not equal return NO, if equal return YES
-- (BOOL)EqualBoxShadow:(WXBoxShadow *_Nullable)boxShadow withBoxShadow:(WXBoxShadow *_Nullable)compareBoxShadow
+- (BOOL)equalBoxShadow:(WXBoxShadow *_Nullable)boxShadow withBoxShadow:(WXBoxShadow *_Nullable)compareBoxShadow
{
if(!compareBoxShadow && !boxShadow) {
return YES;
- } else if (CGColorEqualToColor(boxShadow.shadowColor,compareBoxShadow.shadowColor) &&
+ } else if (CGColorEqualToColor(boxShadow.shadowColor.CGColor,compareBoxShadow.shadowColor.CGColor) &&
CGSizeEqualToSize(boxShadow.shadowOffset,compareBoxShadow.shadowOffset) &&
WXFloatEqual(boxShadow.shadowRadius,compareBoxShadow.shadowRadius)&& (boxShadow.isInset == compareBoxShadow.isInset))
{
@@ -80,7 +80,7 @@
} else {
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds];
self.view.layer.masksToBounds = NO;
- self.view.layer.shadowColor = boxShadow.shadowColor;
+ self.view.layer.shadowColor = boxShadow.shadowColor.CGColor;
self.view.layer.shadowOffset = boxShadow.shadowOffset;
self.view.layer.shadowRadius = boxShadow.shadowRadius;
self.view.layer.shadowOpacity = boxShadow.shadowOpacity;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h b/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h
index f3b2bf4..8f18ace 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h
+++ b/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h
@@ -12,7 +12,7 @@
@interface WXInnerLayer : CAGradientLayer
@property CGFloat boxShadowRadius;
-@property CGColorRef boxShadowColor;
+@property (nonatomic,strong,nullable) UIColor *boxShadowColor;
@property CGSize boxShadowOffset;
@property CGFloat boxShadowOpacity;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m b/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m
index e49c5b6..4029ddb 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m
@@ -50,9 +50,9 @@
CGPathAddRect(outer, NULL, CGRectInset(rect, -1*rect.size.width, -1*rect.size.height));
CGPathAddPath(outer, NULL, bezierPath.CGPath);
CGPathCloseSubpath(outer);
- CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.boxShadowColor);
+ CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.boxShadowColor.CGColor);
CGFloat newComponents[4];
- NSInteger numberOfComponents = CGColorGetNumberOfComponents(self.boxShadowColor);
+ NSInteger numberOfComponents = CGColorGetNumberOfComponents(self.boxShadowColor.CGColor);
switch (numberOfComponents)
{
case 2:
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
index 92c964b..78b0d64 100644
--- a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
+++ b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
@@ -122,7 +122,7 @@
strongSelf.view.frame = strongSelf.calculatedFrame;
[strongSelf configBoxShadow:_boxShadow];
} else {
- if (![strongSelf EqualBoxShadow:_boxShadow withBoxShadow:_lastBoxShadow]) {
+ if (![strongSelf equalBoxShadow:_boxShadow withBoxShadow:_lastBoxShadow]) {
[strongSelf configBoxShadow:_boxShadow];
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h b/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h
index 01dfa5c..5f0faee 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h
@@ -11,7 +11,7 @@
@interface WXBoxShadow : NSObject
-@property(nullable) CGColorRef shadowColor;
+@property(nonatomic,strong,nullable) UIColor *shadowColor;
@property CGSize shadowOffset;
@property CGFloat shadowRadius;
@property BOOL isInset;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00b03746/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m b/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
index 8df636c..c16c12f 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
@@ -12,10 +12,6 @@
@implementation WXBoxShadow
-- (void) dealloc
-{
- CGColorRelease(_shadowColor);
-}
- (instancetype)init
{
@@ -31,16 +27,6 @@
return self;
}
-- (void)setShadowColor: (CGColorRef)shadowColor
-{
- if (shadowColor == _shadowColor)
- return;
-
- CGColorRetain(shadowColor);
- CGColorRelease(_shadowColor);
- _shadowColor = shadowColor;
-}
-
+ (NSArray *)getBoxShadowElementsByBlank:(NSString *)string
{
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
@@ -73,7 +59,7 @@
NSString *str = [string substringWithRange:range];
UIColor *color = [WXConvert UIColor:str];
if (color && [color isKindOfClass:[UIColor class]]) {
- boxShadow.shadowColor = color.CGColor;
+ boxShadow.shadowColor = color;
}
string = [string stringByReplacingOccurrencesOfString:str withString:@""];// remove color string
}
@@ -82,7 +68,7 @@
NSString *str = [boxShadowElements lastObject];
UIColor *color = [WXConvert UIColor:str];
if (color && [color isKindOfClass:[UIColor class]]) {
- boxShadow.shadowColor = color.CGColor;
+ boxShadow.shadowColor = color;
}
string = [string stringByReplacingOccurrencesOfString:str withString:@""];// remove color string
}