You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by bo...@apache.org on 2017/04/17 10:48:26 UTC
[1/2] incubator-weex git commit: *[iOS] keep the code same with
gitlab-ios-package
Repository: incubator-weex
Updated Branches:
refs/heads/0.12-dev 5ea996684 -> 92d91a05b
*[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.12-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]]) {
[2/2] incubator-weex git commit: *[iOS] remove start event and stop
event from slider component.
Posted by bo...@apache.org.
*[iOS] remove start event and stop event from slider component.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/92d91a05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/92d91a05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/92d91a05
Branch: refs/heads/0.12-dev
Commit: 92d91a05b72a7685831a48847e50bf6bcfff620e
Parents: e11dbdf
Author: LiuHongfeng(GuJian) <La...@gmail.com>
Authored: Mon Apr 17 17:36:51 2017 +0800
Committer: LiuHongfeng(GuJian) <La...@gmail.com>
Committed: Mon Apr 17 17:36:51 2017 +0800
----------------------------------------------------------------------
.../Sources/Component/WXSliderComponent.m | 55 +++-----------------
1 file changed, 6 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/92d91a05/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 f0310e5..1077bc8 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
@@ -31,8 +31,9 @@
- (void)sliderView:(WXSliderView *)sliderView sliderViewDidScroll:(UIScrollView *)scrollView;
- (void)sliderView:(WXSliderView *)sliderView didScrollToItemAtIndex:(NSInteger)index;
-- (void)sliderView:(WXSliderView *)sliderView scrollViewDidStartScroll:(UIScrollView *)scrollView;
-- (void)sliderView:(WXSliderView *)sliderView scrollViewDidStopScroll:(UIScrollView *)scrollView;
+
+@optional
+- (void)sliderView:(WXSliderView *)sliderView scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
@end
@@ -44,7 +45,6 @@
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) NSMutableArray *itemViews;
@property (nonatomic, assign) NSInteger currentIndex;
-@property (nonatomic, assign) BOOL isStartScroll;
- (UIScrollView *)scrollView;
- (void)insertItemView:(UIView *)view atIndex:(NSInteger)index;
@@ -296,15 +296,6 @@
- (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]) {
@@ -336,8 +327,8 @@
// called when setContentOffset/scrollRectVisible:animated: finishes. called from the performselector in scrollViewDidScroll if not animating.
-(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
- if (self.delegate && [self.delegate respondsToSelector:@selector(sliderView:scrollViewDidStopScroll:)]) {
- [self.delegate sliderView:self scrollViewDidStopScroll:scrollView];
+ if (self.delegate && [self.delegate respondsToSelector:@selector(sliderView:scrollViewDidEndScrollingAnimation:)]) {
+ [self.delegate sliderView:self scrollViewDidEndScrollingAnimation:scrollView];
}
}
@@ -356,9 +347,6 @@
@property (nonatomic, assign) CGFloat offsetXAccuracy;
@property (nonatomic, assign) BOOL sliderChangeEvent;
@property (nonatomic, assign) BOOL sliderScrollEvent;
-@property (nonatomic, assign) BOOL sliderScrollStartEvent;
-@property (nonatomic, assign) BOOL sliderScrollEndEvent;
-@property (nonatomic, assign) BOOL sliderStartEventFired;
@property (nonatomic, strong) NSMutableArray *childrenView;
@property (nonatomic, assign) BOOL scrollable;
@@ -495,7 +483,7 @@
WXSliderView *sliderView = (WXSliderView *)_view;
[sliderView removeItemView:view];
[sliderView setCurrentIndex:0];
-}ggg
+}
- (void)updateAttributes:(NSDictionary *)attributes
{
@@ -544,12 +532,6 @@
if ([eventName isEqualToString:@"scroll"]) {
_sliderScrollEvent = YES;
}
- if ([eventName isEqualToString:@"scrollstart"]) {
- _sliderScrollStartEvent = YES;
- }
- if ([eventName isEqualToString:@"scrollend"]) {
- _sliderScrollEndEvent = YES;
- }
}
- (void)removeEvent:(NSString *)eventName
@@ -560,12 +542,6 @@
if ([eventName isEqualToString:@"scroll"]) {
_sliderScrollEvent = NO;
}
- if ([eventName isEqualToString:@"scrollstart"]) {
- _sliderScrollStartEvent = NO;
- }
- if ([eventName isEqualToString:@"scrollend"]) {
- _sliderScrollEndEvent = NO;
- }
}
#pragma mark WXIndicatorComponentDelegate Methods
@@ -630,9 +606,6 @@
[self fireEvent:@"scroll" params:@{@"offsetXRatio":[NSNumber numberWithFloat:offsetXRatio]} domChanges:nil];
}
}
- if (!_sliderStartEventFired) {
- [self sliderView:sliderView scrollViewDidStartScroll:scrollView];
- }
}
- (void)sliderView:(WXSliderView *)sliderView didScrollToItemAtIndex:(NSInteger)index
@@ -643,22 +616,6 @@
}
}
-- (void)sliderView:(WXSliderView *)sliderView scrollViewDidStartScroll:(UIScrollView *)scrollView
-{
- if (_sliderScrollStartEvent) {
- [self fireEvent:@"scrollstart" params:nil domChanges:nil];
- }
- _sliderStartEventFired = YES;
-}
-
-- (void)sliderView:(WXSliderView *)sliderView scrollViewDidStopScroll:(UIScrollView *)scrollView
-{
- if (_sliderScrollEndEvent) {
- [self fireEvent:@"scrollend" params:nil domChanges:nil];
- }
- _sliderStartEventFired = NO;
-}
-
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[self _stopAutoPlayTimer];