Skip to content

Commit

Permalink
Fix pager node for interface coalescing (#877)
Browse files Browse the repository at this point in the history
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Fix pager node for interface coalescing

* Fix typo

* change log
  • Loading branch information
wsdwsd0829 authored and Adlai-Holler committed May 19, 2018
1 parent 6799e26 commit 06358d8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)
- [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones).
- User FLT_EPSILON in ASCeilPixelValue and ASFloorPixelValue to help with floating point precision errors when computing layouts for 3x devices. [Ricky Cancro](https://github.com/rcancro) [#838](https://github.com/TextureGroup/Texture/pull/864)
- Disable interface colescing and match to pre-colescing interface update behavior [Max Wang](https://github.com/wsdwsd0829) [#862](https://github.com/TextureGroup/Texture/pull/862)
Expand Down
6 changes: 6 additions & 0 deletions Source/ASDisplayNode+Subclasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)didExitHierarchy ASDISPLAYNODE_REQUIRES_SUPER;

/**
* Called just after the view is added to a window.
* Note: this may be called multiple times during view controller transitions. To overcome this: use didEnterVisibleState or its equavalents.
*/
- (void)didEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER;

/**
* @abstract Whether the view or layer of this display node is currently in a window
*/
Expand Down
10 changes: 10 additions & 0 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,8 @@ - (void)__enterHierarchy
}

__instanceLock__.unlock();

[self didEnterHierarchy];
}

- (void)__exitHierarchy
Expand Down Expand Up @@ -2996,6 +2998,14 @@ - (void)willEnterHierarchy
}
}

- (void)didEnterHierarchy {
ASDisplayNodeAssertMainThread();
ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"You should never call -didEnterHierarchy directly. Appearance is automatically managed by ASDisplayNode");
ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive");
ASDisplayNodeAssert(_flags.isInHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive");
ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__);
}

- (void)didExitHierarchy
{
ASDisplayNodeAssertMainThread();
Expand Down
8 changes: 3 additions & 5 deletions Source/ASPagerNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,12 @@ - (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy
[self setDelegate:nil];
}

- (void)didEnterVisibleState
- (void)didEnterHierarchy
{
[super didEnterVisibleState];
[super didEnterHierarchy];

// Check that our view controller does not automatically set our content insets
// It would be better to have a -didEnterHierarchy hook to put this in, but
// such a hook doesn't currently exist, and in every use case I can imagine,
// the pager is not hosted inside a range-managed node.
// In every use case I can imagine, the pager is not hosted inside a range-managed node.
if (_allowsAutomaticInsetsAdjustment == NO) {
UIViewController *vc = [self.view asdk_associatedViewController];
if (vc.automaticallyAdjustsScrollViewInsets) {
Expand Down

0 comments on commit 06358d8

Please sign in to comment.