mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -128,6 +128,20 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@property (nonatomic, weak) id<ASCollectionViewLayoutInspecting> 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.
|
||||
*
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
@property (nonatomic, assign) BOOL usesSynchronousDataLoading;
|
||||
@property (nonatomic, assign) CGFloat leadingScreensForBatching;
|
||||
@property (weak, nonatomic) id <ASCollectionViewLayoutInspecting> layoutInspector;
|
||||
@property (nonatomic, assign) CGPoint contentOffset;
|
||||
@property (nonatomic, assign) BOOL animatesContentOffset;
|
||||
@end
|
||||
|
||||
@implementation _ASCollectionPendingState
|
||||
@@ -61,6 +63,8 @@
|
||||
_allowsSelection = YES;
|
||||
_allowsMultipleSelection = NO;
|
||||
_inverted = NO;
|
||||
_contentOffset = CGPointZero;
|
||||
_animatesContentOffset = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -189,6 +193,8 @@
|
||||
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 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (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;
|
||||
|
||||
@@ -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.")
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
@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 @@
|
||||
_allowsMultipleSelectionDuringEditing = NO;
|
||||
_inverted = NO;
|
||||
_leadingScreensForBatching = 2;
|
||||
_contentOffset = CGPointZero;
|
||||
_animatesContentOffset = NO;
|
||||
_automaticallyAdjustsContentOffset = NO;
|
||||
}
|
||||
return self;
|
||||
@@ -120,6 +124,7 @@
|
||||
if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) {
|
||||
[view.rangeController updateCurrentRangeWithMode:pendingState.rangeMode];
|
||||
}
|
||||
[view setContentOffset:pendingState.contentOffset animated:pendingState.animatesContentOffset];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,6 +237,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (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;
|
||||
|
||||
@@ -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<NSIndexPath *> *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead.");
|
||||
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSIndexPath *> *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<NSIndexPath *> *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead.");
|
||||
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSIndexPath *> *indexPathsForVisibleRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead.");
|
||||
|
||||
- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead.");
|
||||
|
||||
- (nullable NSArray<NSIndexPath *> *)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.")
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,13 +22,11 @@
|
||||
|
||||
@implementation ASCollectionLayoutContext {
|
||||
Class<ASCollectionLayoutDelegate> _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<ASCollectionLayoutDelegate>)layoutDelegateClass
|
||||
@@ -38,6 +36,7 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_viewportSize = viewportSize;
|
||||
_initialContentOffset = initialContentOffset;
|
||||
_scrollableDirections = scrollableDirections;
|
||||
_elements = elements;
|
||||
_layoutDelegateClass = layoutDelegateClass;
|
||||
@@ -57,6 +56,8 @@
|
||||
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) {
|
||||
|
||||
@@ -70,11 +70,13 @@ static const ASScrollDirection kASStaticScrollDirection = (ASScrollDirectionRigh
|
||||
{
|
||||
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 @@ static const ASScrollDirection kASStaticScrollDirection = (ASScrollDirectionRigh
|
||||
|
||||
// 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,
|
||||
|
||||
@@ -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<ASCollectionLayoutDelegate>)layoutDelegateClass
|
||||
|
||||
@@ -75,6 +75,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, weak) id<ASCollectionViewLayoutInspecting> 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
|
||||
|
||||
@@ -33,6 +33,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, weak) id<ASTableDelegate> asyncDelegate;
|
||||
@property (nonatomic, weak) id<ASTableDataSource> asyncDataSource;
|
||||
@property (nonatomic, assign) CGPoint contentOffset;
|
||||
@property (nonatomic, assign) BOOL automaticallyAdjustsContentOffset;
|
||||
@property (nonatomic, assign) BOOL inverted;
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSIndexPath *> *indexPathsForVisibleRows;
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSIndexPath *> *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<NSIndexPath *> *indexPathsForVisibleRows;
|
||||
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSIndexPath *> *indexPathsForSelectedRows;
|
||||
|
||||
@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow;
|
||||
|
||||
- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point;
|
||||
|
||||
- (nullable NSArray<NSIndexPath *> *)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
|
||||
|
||||
@@ -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 <XCTest/XCTest.h>
|
||||
@@ -128,7 +137,7 @@
|
||||
#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 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
[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 @@
|
||||
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user