Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 58e9c80

Browse files
authored
Fix using UIActivityIndicatorView provided in view block (#2522)
1 parent 8e6f842 commit 58e9c80

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

AsyncDisplayKit/ASDisplayNode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ - (UIView *)_viewToLoad
495495
}
496496

497497
// Update flags related to special handling of UIImageView layers. More details on the flags
498-
if (_flags.synchronous && [_viewClass isSubclassOfClass:[UIImageView class]]) {
498+
if (_flags.synchronous && ([_viewClass isSubclassOfClass:[UIImageView class]] || [_viewClass isSubclassOfClass:[UIActivityIndicatorView class]])) {
499499
_flags.canClearContentsOfLayer = NO;
500500
_flags.canCallSetNeedsDisplayOfLayer = NO;
501501
}

examples/Swift/Sample/TailLoadingCellNode.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ final class TailLoadingCellNode: ASCellNode {
4040

4141
override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec {
4242

43-
spinner.style.flexBasis = ASDimensionMakeWithPoints(0.0)
44-
4543
return ASStackLayoutSpec(
4644
direction: .Horizontal,
4745
spacing: 16,
@@ -59,12 +57,13 @@ final class SpinnerNode: ASDisplayNode {
5957
override init() {
6058
super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .Gray) }, didLoadBlock: nil)
6159

62-
63-
self.style.height = ASDimensionMakeWithPoints(44.0)
60+
// Set spinner node to default size of the activitiy indicator view
61+
self.style.preferredSize = CGSizeMake(20.0, 20.0)
6462
}
6563

6664
override func didLoad() {
6765
super.didLoad()
66+
6867
activityIndicatorView.startAnimating()
6968
}
7069
}

examples/Swift/Sample/ViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ final class ViewController: ASViewController, ASTableDataSource, ASTableDelegate
5555
let rowCount = self.tableNode(tableNode, numberOfRowsInSection: 0)
5656

5757
if state.fetchingMore && indexPath.row == rowCount - 1 {
58-
return TailLoadingCellNode()
58+
let node = TailLoadingCellNode()
59+
node.style.height = ASDimensionMake(44.0)
60+
return node;
5961
}
6062

6163
let node = ASTextCellNode()

0 commit comments

Comments
 (0)