This repository was archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix fade-in effect #257
Open
WenchaoD
wants to merge
4
commits into
dzenbot:master
Choose a base branch
from
WenchaoD:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix fade-in effect #257
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a39c2f0
Merge remote-tracking branch 'dzenbot/master' into patch-1
WenchaoD bfe21f5
Fix fade-in effect
WenchaoD 93ee6a1
Merge remote-tracking branch 'dzenbot/master' into patch-1
WenchaoD 746dafe
Merge remote-tracking branch 'dzenbot/master' into patch-1
WenchaoD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -448,6 +448,9 @@ - (void)dzn_reloadEmptyDataSet | |
|
|
||
| DZNEmptyDataSetView *view = self.emptyDataSetView; | ||
|
|
||
| // Configure empty dataset fade in display | ||
| view.fadeInOnDisplay = [self dzn_shouldFadeIn]; | ||
|
|
||
| if (!view.superview) { | ||
| // Send the view all the way to the back, in case a header and/or footer is present, as well as for sectionHeaders or any other content | ||
| if (([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) && self.subviews.count > 1) { | ||
|
|
@@ -527,9 +530,6 @@ - (void)dzn_reloadEmptyDataSet | |
| // Configure empty dataset userInteraction permission | ||
| view.userInteractionEnabled = [self dzn_isTouchAllowed]; | ||
|
|
||
| // Configure empty dataset fade in display | ||
| view.fadeInOnDisplay = [self dzn_shouldFadeIn]; | ||
|
|
||
| [view setupConstraints]; | ||
|
|
||
| [UIView performWithoutAnimation:^{ | ||
|
|
@@ -735,17 +735,19 @@ - (instancetype)init | |
|
|
||
| - (void)didMoveToSuperview | ||
| { | ||
| self.frame = self.superview.bounds; | ||
|
|
||
| void(^fadeInBlock)(void) = ^{_contentView.alpha = 1.0;}; | ||
|
|
||
| if (self.fadeInOnDisplay) { | ||
| [UIView animateWithDuration:0.25 | ||
| animations:fadeInBlock | ||
| completion:NULL]; | ||
| } | ||
| else { | ||
| fadeInBlock(); | ||
| [super didMoveToSuperview]; | ||
| if (self.superview) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It turns out that when the view is |
||
|
|
||
| self.frame = self.superview.bounds; | ||
|
|
||
| if (self.fadeInOnDisplay) { | ||
| CABasicAnimation *alpha = [CABasicAnimation animationWithKeyPath:@"opacity"]; | ||
| alpha.fromValue = @0; | ||
| alpha.toValue = @1; | ||
| alpha.duration = 0.25; | ||
| [_contentView.layer addAnimation:alpha forKey:@"alpha"]; | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -760,7 +762,6 @@ - (UIView *)contentView | |
| _contentView.translatesAutoresizingMaskIntoConstraints = NO; | ||
| _contentView.backgroundColor = [UIColor clearColor]; | ||
| _contentView.userInteractionEnabled = YES; | ||
| _contentView.alpha = 0; | ||
| } | ||
| return _contentView; | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was moved up a little because in some cases, the method
didMoveToSuperviewwas called before the valuefadeInOnDisplaywas set up. So I thought it would be better to set it before addSubview.