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/21 06:18:31 UTC

[08/50] incubator-weex git commit: *[iOS] keep the code same with gitlab-ios-package

*[iOS] keep the code same with gitlab-ios-package


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

Branch: refs/heads/0.13-dev
Commit: e11dbdf9a149244636fc2b74a63ff0d3c1a26850
Parents: 5ea9966
Author: LiuHongfeng(GuJian) <La...@gmail.com>
Authored: Mon Apr 17 17:04:34 2017 +0800
Committer: LiuHongfeng(GuJian) <La...@gmail.com>
Committed: Mon Apr 17 17:04:34 2017 +0800

----------------------------------------------------------------------
 .../Sources/Component/WXSliderComponent.m       | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e11dbdf9/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
index 4e72d2c..f0310e5 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
@@ -296,6 +296,15 @@
 
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
 {
+    [NSObject cancelPreviousPerformRequestsWithTarget:self];
+    __weak typeof(self) weakSelf = self;
+    if (!weakSelf)
+    {
+        return;
+    }
+    //ensure that the end of scroll is fired.
+    [self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:nil afterDelay:0.3];
+    
     UIView *itemView = nil;
     for (itemView in self.itemViews) {
         if ([self _isItemViewVisiable:itemView]) {
@@ -308,9 +317,6 @@
     if (self.delegate && [self.delegate respondsToSelector:@selector(sliderView:sliderViewDidScroll:)]) {
         [self.delegate sliderView:self sliderViewDidScroll:self.scrollView];
     }
-    //[NSObject cancelPreviousPerformRequestsWithTarget:self];
-    //ensure that the end of scroll is fired.
-    //[self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:nil afterDelay:0.3];
 }
 
 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
@@ -387,7 +393,7 @@
         }
         
         _scrollable = attributes[@"scrollable"] ? [WXConvert BOOL:attributes[@"scrollable"]] : YES;
-
+        
         if (attributes[@"offsetXAccuracy"]) {
             _offsetXAccuracy = [WXConvert CGFloat:attributes[@"offsetXAccuracy"]];
         }
@@ -489,7 +495,7 @@
     WXSliderView *sliderView = (WXSliderView *)_view;
     [sliderView removeItemView:view];
     [sliderView setCurrentIndex:0];
-}
+}ggg
 
 - (void)updateAttributes:(NSDictionary *)attributes
 {
@@ -509,7 +515,7 @@
         
         if (_autoPlay) {
             [self _startAutoPlayTimer];
-        } 
+        }
     }
     
     if (attributes[@"index"]) {
@@ -594,7 +600,7 @@
 - (void)_autoPlayOnTimer
 {
     WXSliderView *sliderView = (WXSliderView *)self.view;
-
+    
     int indicatorCnt = 0;
     for (int i = 0; i < [self.childrenView count]; ++i) {
         if ([self.childrenView[i] isKindOfClass:[WXIndicatorView class]]) {