You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by zs...@apache.org on 2017/04/10 02:46:18 UTC
[3/4] incubator-weex git commit: Merge pull request #1 from
yangshengtao/0.12-dev
Merge pull request #1 from yangshengtao/0.12-dev
add the component type, when the node is virtual node
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e4823690
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e4823690
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e4823690
Branch: refs/heads/0.12-dev
Commit: e48236900f82c6952501ce3f3a28b23099dfb328
Parents: babfa41 ebb1b0e
Author: \u535c\u9053 <70...@qq.com>
Authored: Thu Apr 6 17:30:20 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Thu Apr 6 17:30:20 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m | 1 +
ios/sdk/WeexSDK/Sources/Model/WXComponent.h | 6 ++++++
ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 5 +++++
ios/sdk/WeexSDK/Sources/Utility/WXDefine.h | 11 +++++++++++
ios/sdk/WeexSDK/Sources/Utility/WXType.h | 5 +++++
.../WeexSDK/Sources/View/WXComponent+ViewManagement.m | 3 +++
6 files changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e4823690/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index cecc708,cfd1dbc..adc252f
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@@ -450,36 -455,9 +454,37 @@@
}
+- (void)setGradientLayer
+{
+ if (CGRectEqualToRect(self.view.frame, CGRectZero)) {
+ return;
+ }
+ NSDictionary * linearGradient = [WXUtility linearGradientWithBackgroundImage:_backgroundImage];
+ if (!linearGradient) {
+ return ;
+ }
+
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ __strong typeof(self) strongSelf = weakSelf;
+ /*
+ must insert the gradientLayer at index 0, and then set masksToBounds to match the view bounds
+ or the subview will be invisible
+ */
+
+ if(strongSelf) {
+ UIColor * startColor = (UIColor*)linearGradient[@"startColor"];
+ UIColor * endColor = (UIColor*)linearGradient[@"endColor"];
+ CAGradientLayer * gradientLayer = [WXUtility gradientLayerFromColors:@[startColor, endColor] locations:nil frame:strongSelf.view.bounds gradientType:[linearGradient[@"gradientType"] integerValue]];
+ [strongSelf.view.layer insertSublayer:gradientLayer atIndex:0];
+ strongSelf.view.layer.masksToBounds = YES;
+ }
+ });
+}
+
- (void)_configWXComponentA11yWithAttributes:(NSDictionary *)attributes
{
+ WX_CHECK_COMPONENT_TYPE(self.componentType)
if (attributes[@"role"]){
_role = [WXConvert WXUIAccessibilityTraits:attributes[@"role"]];
self.view.accessibilityTraits = _role;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e4823690/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m
----------------------------------------------------------------------