mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Control the height of the compose window a little better.
Avoids the known hang, which was caused by getting stuck in a loop setting the frame back and forth over and over. Looked like it was adding and then removing (and then adding, etc) the height of a single line of text. Possible the username was shifting back and forth between truncating and wrapping, but have not confirmed that. Fixes #705 IOS client consistently hangs when writing new post at ~= 150 chars
This commit is contained in:
parent
7961514160
commit
804a5d0fda
@ -52,9 +52,12 @@ extension ComposeContentViewModel {
|
||||
guard let self = self else { return }
|
||||
guard self.composeContentTableViewCellIsInTableView(tableView) else { return }
|
||||
UIView.performWithoutAnimation {
|
||||
tableView.beginUpdates()
|
||||
self.composeContentTableViewCell.frame.size.height = height
|
||||
tableView.endUpdates()
|
||||
if height != self.composeContentTableViewCell.contentHeight {
|
||||
tableView.beginUpdates()
|
||||
self.composeContentTableViewCell.contentHeight = height
|
||||
self.composeContentTableViewCell.invalidateIntrinsicContentSize()
|
||||
tableView.endUpdates()
|
||||
}
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -9,6 +9,13 @@ import UIKit
|
||||
import UIHostingConfigurationBackport
|
||||
|
||||
final class ComposeContentTableViewCell: UITableViewCell {
|
||||
|
||||
var contentHeight: CGFloat?
|
||||
|
||||
override var intrinsicContentSize: CGSize {
|
||||
let superContentSize = super.intrinsicContentSize
|
||||
return CGSize(width: superContentSize.width, height: contentHeight ?? superContentSize.height)
|
||||
}
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
|
Loading…
x
Reference in New Issue
Block a user