You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/29 12:13:40 UTC

[13/39] incubator-weex git commit: + [ios] bug fix: boxshadow crash in setshadowcolor

+ [ios] bug fix: boxshadow crash in setshadowcolor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9666cffa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9666cffa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9666cffa

Branch: refs/heads/0.12-dev
Commit: 9666cffa5eee4336c304443632d87070916cafb5
Parents: 5cb0819
Author: \u9f50\u5c71 <su...@163.com>
Authored: Mon Mar 27 18:02:17 2017 +0800
Committer: kfeagle <su...@163.com>
Committed: Mon Mar 27 18:02:17 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Display/WXComponent+BoxShadow.m   |  4 ++++
 ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m         | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9666cffa/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..6c75050 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
@@ -18,6 +18,10 @@
 - (WXBoxShadow *_Nullable)getViewBoxShadow:(UIView *_Nullable)view
 {
     WXBoxShadow *boxShadow = [WXBoxShadow new];
+    boxShadow.shadowColor = [UIColor whiteColor].CGColor;
+    boxShadow.shadowRadius = 0.0f;
+    boxShadow.isInset = NO;
+    boxShadow.shadowOffset = CGSizeZero;
     boxShadow.shadowColor = view.layer.shadowColor;
     boxShadow.shadowOffset = view.layer.shadowOffset;
     boxShadow.shadowRadius = view.layer.shadowRadius;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9666cffa/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 5422747..6701c28 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m
@@ -34,6 +34,10 @@
         return nil;
     }
     WXBoxShadow *boxShadow = [WXBoxShadow new];
+    boxShadow.shadowColor = [UIColor whiteColor].CGColor;
+    boxShadow.shadowRadius = 0.0f;
+    boxShadow.isInset = NO;
+    boxShadow.shadowOffset = CGSizeZero;
     boxShadow.shadowOpacity = 1.0f;
     
     //parse color
@@ -43,13 +47,19 @@
         if (begin.location < end.location && end.location < [string length]) {
             NSRange range = NSMakeRange(begin.location, end.location-begin.location + 1);
             NSString *str = [string substringWithRange:range];
-            boxShadow.shadowColor = [WXConvert UIColor:str].CGColor;
+            UIColor * color = [WXConvert UIColor:str];
+            if (color && [color isKindOfClass:[UIColor class]]) {
+                boxShadow.shadowColor = color.CGColor;
+            }
             string = [string stringByReplacingOccurrencesOfString:str withString:@""];// remove color string
         }
     } else {
         NSArray *boxShadowElements = [self getBoxShadowElementsByBlank:string];
         NSString *str = [boxShadowElements lastObject];
-        boxShadow.shadowColor = [WXConvert UIColor:str].CGColor;
+        UIColor * color = [WXConvert UIColor:str];
+        if (color && [color isKindOfClass:[UIColor class]]) {
+            boxShadow.shadowColor = color.CGColor;
+        }
         string = [string stringByReplacingOccurrencesOfString:str withString:@""];// remove color string
     }