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

Commit

Permalink
Fix using UIActivityIndicatorView provided in view block (#2522)
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki committed Nov 1, 2016
1 parent 8e6f842 commit 58e9c80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AsyncDisplayKit/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ - (UIView *)_viewToLoad
}

// Update flags related to special handling of UIImageView layers. More details on the flags
if (_flags.synchronous && [_viewClass isSubclassOfClass:[UIImageView class]]) {
if (_flags.synchronous && ([_viewClass isSubclassOfClass:[UIImageView class]] || [_viewClass isSubclassOfClass:[UIActivityIndicatorView class]])) {
_flags.canClearContentsOfLayer = NO;
_flags.canCallSetNeedsDisplayOfLayer = NO;
}
Expand Down
7 changes: 3 additions & 4 deletions examples/Swift/Sample/TailLoadingCellNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ final class TailLoadingCellNode: ASCellNode {

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

spinner.style.flexBasis = ASDimensionMakeWithPoints(0.0)

return ASStackLayoutSpec(
direction: .Horizontal,
spacing: 16,
Expand All @@ -59,12 +57,13 @@ final class SpinnerNode: ASDisplayNode {
override init() {
super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .Gray) }, didLoadBlock: nil)


self.style.height = ASDimensionMakeWithPoints(44.0)
// Set spinner node to default size of the activitiy indicator view
self.style.preferredSize = CGSizeMake(20.0, 20.0)
}

override func didLoad() {
super.didLoad()

activityIndicatorView.startAnimating()
}
}
4 changes: 3 additions & 1 deletion examples/Swift/Sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ final class ViewController: ASViewController, ASTableDataSource, ASTableDelegate
let rowCount = self.tableNode(tableNode, numberOfRowsInSection: 0)

if state.fetchingMore && indexPath.row == rowCount - 1 {
return TailLoadingCellNode()
let node = TailLoadingCellNode()
node.style.height = ASDimensionMake(44.0)
return node;
}

let node = ASTextCellNode()
Expand Down

0 comments on commit 58e9c80

Please sign in to comment.