mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-29 12:02:11 +00:00
Fix table pre-scrolling to selection
iOS is broken, must wrap in a DispatchQueue.main.async
This commit is contained in:
parent
8a7b0389ed
commit
a4a82fbd03
@ -120,7 +120,7 @@ class EndpointViewController: UIViewController, TableModelHost {
|
||||
|
||||
tableView.reloadData()
|
||||
if let ip = selectedIndexPath {
|
||||
tableView.scrollToRow(at: ip, at: .middle, animated: false)
|
||||
tableView.scrollToRowAsync(at: ip)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class OrganizerViewController: UITableViewController, TableModelHost {
|
||||
|
||||
tableView.reloadData()
|
||||
if let ip = selectedIndexPath {
|
||||
tableView.scrollToRow(at: ip, at: .middle, animated: false)
|
||||
tableView.scrollToRowAsync(at: ip)
|
||||
}
|
||||
|
||||
service.delegate = self
|
||||
|
@ -53,7 +53,7 @@ class ProviderPoolViewController: UIViewController {
|
||||
title = L10n.Service.Cells.Provider.Pool.caption
|
||||
tableView.reloadData()
|
||||
if let ip = selectedIndexPath {
|
||||
tableView.scrollToRow(at: ip, at: .middle, animated: false)
|
||||
tableView.scrollToRowAsync(at: ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class ProviderPresetViewController: UIViewController {
|
||||
title = L10n.Service.Cells.Provider.Preset.caption
|
||||
tableView.reloadData()
|
||||
if let ip = selectedIndexPath {
|
||||
tableView.scrollToRow(at: ip, at: .middle, animated: false)
|
||||
tableView.scrollToRowAsync(at: ip)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,6 +258,10 @@ public class AppConstants {
|
||||
"Circle Icons",
|
||||
"The logo is taken from the awesome Circle Icons set by Nick Roach."
|
||||
),
|
||||
Notice(
|
||||
"Country flags",
|
||||
"https://github.com/lipis/flag-icon-css"
|
||||
),
|
||||
Notice(
|
||||
"OpenVPN",
|
||||
"© 2002-2018 OpenVPN Inc. - OpenVPN is a registered trademark of OpenVPN Inc."
|
||||
|
@ -223,3 +223,11 @@ public extension Array where Element: CustomStringConvertible {
|
||||
return sorted { $0.description.lowercased() < $1.description.lowercased() }
|
||||
}
|
||||
}
|
||||
|
||||
public extension UITableView {
|
||||
func scrollToRowAsync(at indexPath: IndexPath) {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.scrollToRow(at: indexPath, at: .middle, animated: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user