Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit af516f2

Browse files
author
huanglei.hl
committed
[iOS] Support to use loading-indicator separately.
* feature: Support to use loading-indicator separately. Use animating property to control. * doc pr: apache/incubator-weex-site#363 * demo: http://dotwe.org/vue/15b0ac96db6e1837ef5c27c0345b7fb6
1 parent 36dce32 commit af516f2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ios/sdk/WeexSDK/Sources/Component/WXLoadingIndicator.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
@implementation WXLoadingIndicator {
2424
UIActivityIndicatorView *_indicator;
2525
UIColor *_indicatorColor;
26+
id _animating;
2627
}
2728

2829
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance {
@@ -31,6 +32,9 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDict
3132
if (styles[@"color"]) {
3233
_indicatorColor = [WXConvert UIColor:styles[@"color"]];
3334
}
35+
if (attributes[@"animating"]) {
36+
_animating = attributes[@"animating"];
37+
}
3438
}
3539
return self;
3640
}
@@ -45,6 +49,13 @@ - (void)viewDidLoad {
4549
if (_indicatorColor) {
4650
_indicator.color = _indicatorColor;
4751
}
52+
if (_animating) {
53+
if ([WXConvert BOOL:_animating]) {
54+
[_indicator startAnimating];
55+
} else {
56+
[_indicator stopAnimating];
57+
}
58+
}
4859
}
4960

5061
- (void)updateStyles:(NSDictionary *)styles {
@@ -54,6 +65,19 @@ - (void)updateStyles:(NSDictionary *)styles {
5465
}
5566
}
5667

68+
- (void)updateAttributes:(NSDictionary *)attributes
69+
{
70+
if (attributes[@"animating"]) {
71+
_animating = attributes[@"animating"];
72+
73+
if ([WXConvert BOOL:_animating]) {
74+
[_indicator startAnimating];
75+
} else {
76+
[_indicator stopAnimating];
77+
}
78+
}
79+
}
80+
5781
#pragma mark - lifeCircle
5882

5983
- (void)viewWillUnload {

0 commit comments

Comments
 (0)