mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Fix using UIActivityIndicatorView provided in view block (#2522)
This commit is contained in:
committed by
GitHub
parent
8e6f842b8d
commit
58e9c807b9
@@ -495,7 +495,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update flags related to special handling of UIImageView layers. More details on the flags
|
// 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.canClearContentsOfLayer = NO;
|
||||||
_flags.canCallSetNeedsDisplayOfLayer = NO;
|
_flags.canCallSetNeedsDisplayOfLayer = NO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ final class TailLoadingCellNode: ASCellNode {
|
|||||||
|
|
||||||
override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
||||||
|
|
||||||
spinner.style.flexBasis = ASDimensionMakeWithPoints(0.0)
|
|
||||||
|
|
||||||
return ASStackLayoutSpec(
|
return ASStackLayoutSpec(
|
||||||
direction: .Horizontal,
|
direction: .Horizontal,
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
@@ -59,12 +57,13 @@ final class SpinnerNode: ASDisplayNode {
|
|||||||
override init() {
|
override init() {
|
||||||
super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .Gray) }, didLoadBlock: nil)
|
super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .Gray) }, didLoadBlock: nil)
|
||||||
|
|
||||||
|
// Set spinner node to default size of the activitiy indicator view
|
||||||
self.style.height = ASDimensionMakeWithPoints(44.0)
|
self.style.preferredSize = CGSizeMake(20.0, 20.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
super.didLoad()
|
super.didLoad()
|
||||||
|
|
||||||
activityIndicatorView.startAnimating()
|
activityIndicatorView.startAnimating()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ final class ViewController: ASViewController, ASTableDataSource, ASTableDelegate
|
|||||||
let rowCount = self.tableNode(tableNode, numberOfRowsInSection: 0)
|
let rowCount = self.tableNode(tableNode, numberOfRowsInSection: 0)
|
||||||
|
|
||||||
if state.fetchingMore && indexPath.row == rowCount - 1 {
|
if state.fetchingMore && indexPath.row == rowCount - 1 {
|
||||||
return TailLoadingCellNode()
|
let node = TailLoadingCellNode()
|
||||||
|
node.style.height = ASDimensionMake(44.0)
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = ASTextCellNode()
|
let node = ASTextCellNode()
|
||||||
|
|||||||
Reference in New Issue
Block a user