You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/04 09:00:08 UTC

[2/4] incubator-weex git commit: * [ios] adapter for iOS 11

* [ios] adapter for iOS 11


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

Branch: refs/heads/release-0.16
Commit: 840094a3b12d54f1ebe404235af045bf05701749
Parents: 66d8dde
Author: acton393 <zh...@gmail.com>
Authored: Tue Oct 3 18:48:30 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Wed Oct 4 14:55:39 2017 +0800

----------------------------------------------------------------------
 .../Component/RecycleList/WXRecycleListComponent.m   |  7 -------
 .../Sources/Component/Recycler/WXRecyclerComponent.m |  7 -------
 ios/sdk/WeexSDK/Sources/Component/WXListComponent.m  |  7 -------
 .../WeexSDK/Sources/Component/WXScrollerComponent.m  | 15 +++++++--------
 4 files changed, 7 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/840094a3/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.m b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.m
index a1be149..71a52f5 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.m
@@ -101,13 +101,6 @@ WX_EXPORT_METHOD(@selector(scrollTo:options:))
     _collectionView.allowsMultipleSelection = NO;
     _collectionView.dataSource = self;
     _collectionView.delegate = self;
-#ifdef __IPHONE_11_0
-    if (@available(iOS 11.0, *)) {
-        _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    } else {
-        // Fallback on earlier versions
-    }
-#endif
     
     _templateManager.collectionView = _collectionView;
     _updateManager.collectionView = _collectionView;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/840094a3/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index 63cbf29..1164472 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -173,13 +173,6 @@ typedef enum : NSUInteger {
     
     _dragController.dragingCell = [[WXCollectionViewCell alloc] initWithFrame:CGRectMake(0, 0, 100, 100/2.0f)];
     _dragController.collectionView = _collectionView;
-#ifdef __IPHONE_11_0
-    if (@available(iOS 11.0, *)) {
-        _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    } else {
-        // Fallback on earlier versions
-    }
-#endif
     
     [self performUpdatesWithCompletion:^(BOOL finished) {
         

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/840094a3/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index f1b3361..cb9237f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -155,13 +155,6 @@
     _tableView.delegate = self;
     _tableView.dataSource = self;
     _tableView.userInteractionEnabled = YES;
-#ifdef __IPHONE_11_0
-    if (@available(iOS 11.0, *)) {
-        _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    } else {
-        // Fallback on earlier versions
-    }
-#endif
 }
 
 - (void)viewWillUnload

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/840094a3/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index d592a8c..5d4da0a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -26,6 +26,9 @@
 #import "WXUtility.h"
 #import "WXLoadingComponent.h"
 #import "WXRefreshComponent.h"
+@interface UIScrollView(UIScrollerView_ContentInsetAdjustmentBehavior)
+@property(nonatomic, assign)NSUInteger contentInsetAdjustmentBehavior;
+@end
 
 @interface WXScrollToTarget : NSObject
 
@@ -154,14 +157,10 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
     scrollView.pagingEnabled = _pagingEnabled;
     scrollView.alwaysBounceHorizontal = _alwaysScrollableHorizontal;
     scrollView.alwaysBounceVertical = _alwaysScrollableVertical;
-    
-#ifdef __IPHONE_11_0
-    if (@available(iOS 11.0, *)) {
-        scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    } else {
-        // Fallback on earlier versions
+    if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
+        // now use the runtime to forbid the contentInset being Adjusted
+        scrollView.contentInsetAdjustmentBehavior = 2;
     }
-#endif
     
     if (self.ancestorScroller) {
         scrollView.scrollsToTop = NO;
@@ -522,7 +521,7 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
             distance = scrollView.contentOffset.y - _lastScrollEventFiredOffset.y;
         }
         if (fabs(distance) >= _offsetAccuracy) {
-            [self fireEvent:@"scroll" params:@{@"contentSize":contentSizeData,@"contentOffset":contentOffsetData} domChanges:nil];
+//            [self fireEvent:@"scroll" params:@{@"contentSize":contentSizeData,@"contentOffset":contentOffsetData} domChanges:nil];
             _lastScrollEventFiredOffset = scrollView.contentOffset;
         }
     }