mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-03 02:37:37 +01:00
Correctly update tableview when height of cell changes, to avoid scrolling problems later.
This commit is contained in:
parent
34cf069c20
commit
a5ca642a7f
@ -15,6 +15,21 @@ import UIKit
|
||||
import WebKit
|
||||
import MastodonSDK
|
||||
|
||||
extension UIView {
|
||||
func containingView<T>(ofClass: T.Type) -> T? {
|
||||
var ancestor = superview
|
||||
while ancestor != nil {
|
||||
if let instanceOfRequestedType = ancestor as? T
|
||||
{
|
||||
return instanceOfRequestedType
|
||||
} else {
|
||||
ancestor = ancestor?.superview
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
public protocol StatusCardControlDelegate: AnyObject {
|
||||
func statusCardControl(_ statusCardControl: StatusCardControl, didTapURL url: URL)
|
||||
func statusCardControl(_ statusCardControl: StatusCardControl, didTapAuthor author: Mastodon.Entity.Account)
|
||||
@ -289,6 +304,9 @@ public final class StatusCardControl: UIControl {
|
||||
}(),
|
||||
placeholderImage: icon(for: card.layout)
|
||||
) { [weak self] image, _, _, _ in
|
||||
let tableView = self?.containingView(ofClass: UITableView.self)
|
||||
tableView?.beginUpdates()
|
||||
defer { tableView?.endUpdates() }
|
||||
if image == nil {
|
||||
self?.imageView.isHidden = true
|
||||
self?.imageDividerView.isHidden = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user