Fix using UIActivityIndicatorView provided in view block (#2522)

This commit is contained in:
Michael Schneider
2016-11-01 07:58:54 -07:00
committed by GitHub
parent 8e6f842b8d
commit 58e9c807b9
3 changed files with 7 additions and 6 deletions

View File

@@ -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,
@@ -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()
}
}

View File

@@ -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()