From dc3be352af1b057d49391c710b7bfa72b07a50ba Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Thu, 10 Aug 2017 17:47:26 +0100 Subject: [PATCH] [ASTableNode][ASCollectionNode] Add content offset bridging property (#460) - Add content offset bridging property to table and collection node - And use it in `ASCollectionLayout` to avoid measuring unrelated nodes during the first layout. - Update CHANGELOG and highlight deprecated methods --- CHANGELOG.md | 1 + Source/ASCollectionNode.h | 14 ++++++++ Source/ASCollectionNode.mm | 30 +++++++++++++++++ Source/ASCollectionView.h | 7 ++++ Source/ASTableNode.h | 14 ++++++++ Source/ASTableNode.mm | 32 +++++++++++++++++++ Source/ASTableView.h | 18 +++++++---- Source/Details/ASCollectionLayoutContext.h | 1 + Source/Details/ASCollectionLayoutContext.m | 7 ++-- Source/Private/ASCollectionLayout.mm | 6 ++-- .../ASCollectionLayoutContext+Private.h | 1 + .../Private/ASCollectionView+Undeprecated.h | 4 +++ Source/Private/ASTableView+Undeprecated.h | 32 +++++++++---------- Tests/ASPagerNodeTests.m | 17 +++++++--- Tests/ASTableViewTests.mm | 4 +-- 15 files changed, 154 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bf0db81..3751a2a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Fix an issue that causes calculatedLayoutDidChange being called needlessly. [Huy Nguyen](https://github.com/nguyenhuy) [#490](https://github.com/TextureGroup/Texture/pull/490) - Negate iOS 11 automatic estimated table row heights. [Christian Selig](https://github.com/christianselig) [#485](https://github.com/TextureGroup/Texture/pull/485) - Rename ASCellNode.viewModel to ASCellNode.nodeViewModel to reduce collisions with subclass properties implemented by clients. [Adlai Holler](https://github.com/Adlai-Holler) [#499](https://github.com/TextureGroup/Texture/pull/499) +- [Breaking] Add content offset bridging property to ASTableNode and ASCollectionNode. Deprecate related methods in ASTableView and ASCollectionView [Huy Nguyen](https://github.com/nguyenhuy) [#460](https://github.com/TextureGroup/Texture/pull/460) ##2.3.5 - Fix an issue where inserting/deleting sections could lead to inconsistent supplementary element behavior. [Adlai Holler](https://github.com/Adlai-Holler) diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index 22f4ae601..0ca893c2d 100644 --- a/Source/ASCollectionNode.h +++ b/Source/ASCollectionNode.h @@ -128,6 +128,20 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, weak) id layoutInspector; +/** + * The offset of the content view's origin from the collection node's origin. Defaults to CGPointZero. + */ +@property (nonatomic, assign) CGPoint contentOffset; + +/** + * Sets the offset from the content node’s origin to the collection node’s origin. + * + * @param contentOffset The offset + * + * @param animated YES to animate to this new offset at a constant velocity, NO to not aniamte and immediately make the transition. + */ +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; + /** * Tuning parameters for a range type in full mode. * diff --git a/Source/ASCollectionNode.mm b/Source/ASCollectionNode.mm index 81c9a907a..b867a0ea9 100644 --- a/Source/ASCollectionNode.mm +++ b/Source/ASCollectionNode.mm @@ -49,6 +49,8 @@ @interface _ASCollectionPendingState : NSObject @property (nonatomic, assign) BOOL usesSynchronousDataLoading; @property (nonatomic, assign) CGFloat leadingScreensForBatching; @property (weak, nonatomic) id layoutInspector; +@property (nonatomic, assign) CGPoint contentOffset; +@property (nonatomic, assign) BOOL animatesContentOffset; @end @implementation _ASCollectionPendingState @@ -61,6 +63,8 @@ - (instancetype)init _allowsSelection = YES; _allowsMultipleSelection = NO; _inverted = NO; + _contentOffset = CGPointZero; + _animatesContentOffset = NO; } return self; } @@ -189,6 +193,8 @@ - (void)didLoad if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { [view.rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; } + + [view setContentOffset:pendingState.contentOffset animated:pendingState.animatesContentOffset]; // Don't need to set collectionViewLayout to the view as the layout was already used to init the view in view block. } @@ -434,6 +440,30 @@ - (UICollectionViewLayout *)collectionViewLayout } } +- (void)setContentOffset:(CGPoint)contentOffset +{ + [self setContentOffset:contentOffset animated:NO]; +} + +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated +{ + if ([self pendingState]) { + _pendingState.contentOffset = contentOffset; + _pendingState.animatesContentOffset = animated; + } else { + [self.view setContentOffset:contentOffset animated:animated]; + } +} + +- (CGPoint)contentOffset +{ + if ([self pendingState]) { + return _pendingState.contentOffset; + } else { + return self.view.contentOffset; + } +} + - (ASScrollDirection)scrollDirection { return [self isNodeLoaded] ? self.view.scrollDirection : ASScrollDirectionNone; diff --git a/Source/ASCollectionView.h b/Source/ASCollectionView.h index b2f015cf5..f4dd89138 100644 --- a/Source/ASCollectionView.h +++ b/Source/ASCollectionView.h @@ -141,6 +141,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic) BOOL zeroContentInsets ASDISPLAYNODE_DEPRECATED_MSG("Set automaticallyAdjustsScrollViewInsets=NO on your view controller instead."); +/** + * The point at which the origin of the content view is offset from the origin of the collection view. + */ +@property (nonatomic, assign) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); + /** * The object that acts as the asynchronous delegate of the collection view * @@ -407,6 +412,8 @@ NS_ASSUME_NONNULL_BEGIN */ - (NSArray<__kindof ASCellNode *> *)visibleNodes AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); + @end ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDataSource.") diff --git a/Source/ASTableNode.h b/Source/ASTableNode.h index 59fb7183e..20d59d2e3 100644 --- a/Source/ASTableNode.h +++ b/Source/ASTableNode.h @@ -55,6 +55,20 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, assign) BOOL inverted; +/** + * The offset of the content view's origin from the table node's origin. Defaults to CGPointZero. + */ +@property (nonatomic, assign) CGPoint contentOffset; + +/** + * Sets the offset from the content node’s origin to the table node’s origin. + * + * @param contentOffset The offset + * + * @param animated YES to animate to this new offset at a constant velocity, NO to not aniamte and immediately make the transition. + */ +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; + /** * YES to automatically adjust the contentOffset when cells are inserted or deleted above * visible cells, maintaining the users' visible scroll position. diff --git a/Source/ASTableNode.mm b/Source/ASTableNode.mm index a6e7d8e97..4cd7fd923 100644 --- a/Source/ASTableNode.mm +++ b/Source/ASTableNode.mm @@ -43,6 +43,8 @@ @interface _ASTablePendingState : NSObject @property (nonatomic, assign) BOOL allowsMultipleSelectionDuringEditing; @property (nonatomic, assign) BOOL inverted; @property (nonatomic, assign) CGFloat leadingScreensForBatching; +@property (nonatomic, assign) CGPoint contentOffset; +@property (nonatomic, assign) BOOL animatesContentOffset; @property (nonatomic, assign) BOOL automaticallyAdjustsContentOffset; @end @@ -58,6 +60,8 @@ - (instancetype)init _allowsMultipleSelectionDuringEditing = NO; _inverted = NO; _leadingScreensForBatching = 2; + _contentOffset = CGPointZero; + _animatesContentOffset = NO; _automaticallyAdjustsContentOffset = NO; } return self; @@ -120,6 +124,7 @@ - (void)didLoad if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { [view.rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; } + [view setContentOffset:pendingState.contentOffset animated:pendingState.animatesContentOffset]; } } @@ -232,6 +237,33 @@ - (CGFloat)leadingScreensForBatching } } +- (void)setContentOffset:(CGPoint)contentOffset +{ + [self setContentOffset:contentOffset animated:NO]; +} + +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated +{ + _ASTablePendingState *pendingState = self.pendingState; + if (pendingState) { + pendingState.contentOffset = contentOffset; + pendingState.animatesContentOffset = animated; + } else { + ASDisplayNodeAssert(self.nodeLoaded, @"ASTableNode should be loaded if pendingState doesn't exist"); + [self.view setContentOffset:contentOffset animated:animated]; + } +} + +- (CGPoint)contentOffset +{ + _ASTablePendingState *pendingState = self.pendingState; + if (pendingState) { + return pendingState.contentOffset; + } else { + return self.view.contentOffset; + } +} + - (void)setAutomaticallyAdjustsContentOffset:(BOOL)automaticallyAdjustsContentOffset { _ASTablePendingState *pendingState = self.pendingState; diff --git a/Source/ASTableView.h b/Source/ASTableView.h index eb0c92c98..5877ab4d6 100644 --- a/Source/ASTableView.h +++ b/Source/ASTableView.h @@ -67,6 +67,10 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, assign) CGFloat leadingScreensForBatching ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +/** + * The offset of the content view's origin from the table node's origin. Defaults to CGPointZero. + */ +@property (nonatomic, assign) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); /** * YES to automatically adjust the contentOffset when cells are inserted or deleted above @@ -84,6 +88,12 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, assign) BOOL inverted ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); + +@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); + +@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); + /** * Tuning parameters for a range type in full mode. * @@ -138,12 +148,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); -@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - - (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); @@ -241,6 +245,8 @@ NS_ASSUME_NONNULL_BEGIN /// Deprecated in 2.0. You should not call this method. - (void)clearFetchedData ASDISPLAYNODE_DEPRECATED_MSG("You should not call this method directly. Intead, rely on the Interstate State callback methods."); +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); + @end ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASTableDataSource.") diff --git a/Source/Details/ASCollectionLayoutContext.h b/Source/Details/ASCollectionLayoutContext.h index a20873a81..5c2fdbcab 100644 --- a/Source/Details/ASCollectionLayoutContext.h +++ b/Source/Details/ASCollectionLayoutContext.h @@ -27,6 +27,7 @@ AS_SUBCLASSING_RESTRICTED @interface ASCollectionLayoutContext : NSObject @property (nonatomic, assign, readonly) CGSize viewportSize; +@property (nonatomic, assign, readonly) CGPoint initialContentOffset; @property (nonatomic, assign, readonly) ASScrollDirection scrollableDirections; @property (nonatomic, weak, readonly) ASElementMap *elements; @property (nonatomic, strong, readonly, nullable) id additionalInfo; diff --git a/Source/Details/ASCollectionLayoutContext.m b/Source/Details/ASCollectionLayoutContext.m index eff48afb6..06dcd08f9 100644 --- a/Source/Details/ASCollectionLayoutContext.m +++ b/Source/Details/ASCollectionLayoutContext.m @@ -22,13 +22,11 @@ @implementation ASCollectionLayoutContext { Class _layoutDelegateClass; - - // This ivar doesn't directly involve in the layout calculation process, i.e contexts can be equal regardless of the layout caches. - // As a result, this ivar is ignored in -isEqualToContext: and -hash. __weak ASCollectionLayoutCache *_layoutCache; } - (instancetype)initWithViewportSize:(CGSize)viewportSize + initialContentOffset:(CGPoint)initialContentOffset scrollableDirections:(ASScrollDirection)scrollableDirections elements:(ASElementMap *)elements layoutDelegateClass:(Class)layoutDelegateClass @@ -38,6 +36,7 @@ - (instancetype)initWithViewportSize:(CGSize)viewportSize self = [super init]; if (self) { _viewportSize = viewportSize; + _initialContentOffset = initialContentOffset; _scrollableDirections = scrollableDirections; _elements = elements; _layoutDelegateClass = layoutDelegateClass; @@ -57,6 +56,8 @@ - (ASCollectionLayoutCache *)layoutCache return _layoutCache; } +// NOTE: Some properties, like initialContentOffset and layoutCache are ignored in -isEqualToContext: and -hash. +// That is because contexts can be equal regardless of the content offsets or layout caches. - (BOOL)isEqualToContext:(ASCollectionLayoutContext *)context { if (context == nil) { diff --git a/Source/Private/ASCollectionLayout.mm b/Source/Private/ASCollectionLayout.mm index 2ecc312c7..e8ade9feb 100644 --- a/Source/Private/ASCollectionLayout.mm +++ b/Source/Private/ASCollectionLayout.mm @@ -70,11 +70,13 @@ - (ASCollectionLayoutContext *)layoutContextWithElements:(ASElementMap *)element { ASDisplayNodeAssertMainThread(); CGSize viewportSize = [self _viewportSize]; + CGPoint contentOffset = _collectionNode.contentOffset; id additionalInfo = nil; if (_layoutDelegateFlags.implementsAdditionalInfoForLayoutWithElements) { additionalInfo = [_layoutDelegate additionalInfoForLayoutWithElements:elements]; } return [[ASCollectionLayoutContext alloc] initWithViewportSize:viewportSize + initialContentOffset:contentOffset scrollableDirections:[_layoutDelegate scrollableDirections] elements:elements layoutDelegateClass:[_layoutDelegate class] @@ -93,8 +95,8 @@ + (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutConte // Measure elements in the measure range ahead of time, block on the initial rect as it'll be visible shortly CGSize viewportSize = context.viewportSize; - // TODO Consider content offset of the collection node - CGRect initialRect = CGRectMake(0, 0, viewportSize.width, viewportSize.height); + CGPoint contentOffset = context.initialContentOffset; + CGRect initialRect = CGRectMake(contentOffset.x, contentOffset.y, viewportSize.width, viewportSize.height); CGRect measureRect = CGRectExpandToRangeWithScrollableDirections(initialRect, kASDefaultMeasureRangeTuningParameters, context.scrollableDirections, diff --git a/Source/Private/ASCollectionLayoutContext+Private.h b/Source/Private/ASCollectionLayoutContext+Private.h index 3c615aef2..0c6686e51 100644 --- a/Source/Private/ASCollectionLayoutContext+Private.h +++ b/Source/Private/ASCollectionLayoutContext+Private.h @@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak, readonly) ASCollectionLayoutCache *layoutCache; - (instancetype)initWithViewportSize:(CGSize)viewportSize + initialContentOffset:(CGPoint)initialContentOffset scrollableDirections:(ASScrollDirection)scrollableDirections elements:(ASElementMap *)elements layoutDelegateClass:(Class)layoutDelegateClass diff --git a/Source/Private/ASCollectionView+Undeprecated.h b/Source/Private/ASCollectionView+Undeprecated.h index be3a3f1a0..811ba7baf 100644 --- a/Source/Private/ASCollectionView+Undeprecated.h +++ b/Source/Private/ASCollectionView+Undeprecated.h @@ -75,6 +75,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id layoutInspector; +@property (nonatomic, assign) CGPoint contentOffset; + /** * Tuning parameters for a range type in full mode. * @@ -292,6 +294,8 @@ NS_ASSUME_NONNULL_BEGIN */ - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; + @end NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASTableView+Undeprecated.h b/Source/Private/ASTableView+Undeprecated.h index f7d0d2a26..70098940f 100644 --- a/Source/Private/ASTableView+Undeprecated.h +++ b/Source/Private/ASTableView+Undeprecated.h @@ -33,6 +33,19 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id asyncDelegate; @property (nonatomic, weak) id asyncDataSource; +@property (nonatomic, assign) CGPoint contentOffset; +@property (nonatomic, assign) BOOL automaticallyAdjustsContentOffset; +@property (nonatomic, assign) BOOL inverted; +@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows; +@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows; +@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow; + +/** + * The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called. + * + * Defaults to two screenfuls. + */ +@property (nonatomic, assign) CGFloat leadingScreensForBatching; /** * Initializer. @@ -44,10 +57,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style; -@property (nonatomic, assign) BOOL automaticallyAdjustsContentOffset; - -@property (nonatomic, assign) BOOL inverted; - /** * Tuning parameters for a range type in full mode. * @@ -109,12 +118,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; -@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows; - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows; - -@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow; - - (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point; - (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect; @@ -135,13 +138,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; -/** - * The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic, assign) CGFloat leadingScreensForBatching; - /** * Reload everything from scratch, destroying the working range and all cached nodes. * @@ -311,5 +307,7 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; + @end NS_ASSUME_NONNULL_END diff --git a/Tests/ASPagerNodeTests.m b/Tests/ASPagerNodeTests.m index 428247c53..4b45a8c1e 100644 --- a/Tests/ASPagerNodeTests.m +++ b/Tests/ASPagerNodeTests.m @@ -2,8 +2,17 @@ // ASPagerNodeTests.m // Texture // -// Created by Luke Parham on 11/6/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional +// grant of patent rights can be found in the PATENTS file in the same directory. +// +// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, +// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -128,7 +137,7 @@ - (void)DISABLED_testThatRootPagerNodeDoesGetTheRightInsetWhilePoppingBack #pragma clang diagnostic pop XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame)); XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(cell.frame)); - XCTAssertEqual(pagerNode.view.contentOffset.y, 0); + XCTAssertEqual(pagerNode.contentOffset.y, 0); XCTAssertEqual(pagerNode.view.contentInset.top, 0); e = [self expectationWithDescription:@"Transition completed"]; @@ -158,7 +167,7 @@ - (void)DISABLED_testThatRootPagerNodeDoesGetTheRightInsetWhilePoppingBack #pragma clang diagnostic pop XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame)); XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(cell.frame)); - XCTAssertEqual(pagerNode.view.contentOffset.y, 0); + XCTAssertEqual(pagerNode.contentOffset.y, 0); XCTAssertEqual(pagerNode.view.contentInset.top, 0); } diff --git a/Tests/ASTableViewTests.mm b/Tests/ASTableViewTests.mm index 6c53fc849..e7388ccf7 100644 --- a/Tests/ASTableViewTests.mm +++ b/Tests/ASTableViewTests.mm @@ -815,7 +815,7 @@ - (void)testAutomaticallyAdjustingContentOffset [node waitUntilAllUpdatesAreCommitted]; CGFloat rowHeight = [node.view rectForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].size.height; // Scroll to row (0,1) + 10pt - node.view.contentOffset = CGPointMake(0, rowHeight + 10); + node.contentOffset = CGPointMake(0, rowHeight + 10); [node performBatchAnimated:NO updates:^{ // Delete row 0 from all sections. @@ -829,7 +829,7 @@ - (void)testAutomaticallyAdjustingContentOffset // Now that row (0,0) is deleted, we should have slid up to be at just 10 // i.e. we should have subtracted the deleted row height from our content offset. - XCTAssertEqual(node.view.contentOffset.y, 10); + XCTAssertEqual(node.contentOffset.y, 10); } @end