fix create closed group screen

pull/699/head
ryanzhao 3 years ago
parent c5c2d7e8a1
commit 4c2b01ca42

@ -27,6 +27,10 @@ final class NewClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegate
private var selectedContacts: Set<String> = [] private var selectedContacts: Set<String> = []
private var searchText: String = "" private var searchText: String = ""
// MARK: - Layout
private var tableViewWidth: NSLayoutConstraint?
// MARK: - Components // MARK: - Components
private lazy var nameTextField: TextField = { private lazy var nameTextField: TextField = {
@ -105,6 +109,11 @@ final class NewClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegate
// Set up content // Set up content
setUpViewHierarchy() setUpViewHierarchy()
} }
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
tableViewWidth?.constant = size.width
}
private func setUpViewHierarchy() { private func setUpViewHierarchy() {
guard !contactProfiles.isEmpty else { guard !contactProfiles.isEmpty else {
@ -158,15 +167,13 @@ final class NewClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegate
mainStackView.addArrangedSubview(separator) mainStackView.addArrangedSubview(separator)
tableView.set(.height, to: CGFloat(contactProfiles.count * 65 + 100)) // A cell is exactly 65 points high tableView.set(.height, to: CGFloat(contactProfiles.count * 65 + 100)) // A cell is exactly 65 points high
tableView.set(.width, to: UIScreen.main.bounds.width) tableViewWidth = tableView.set(.width, to: UIScreen.main.bounds.width)
mainStackView.addArrangedSubview(tableView) mainStackView.addArrangedSubview(tableView)
let scrollView: UIScrollView = UIScrollView(wrapping: mainStackView, withInsets: UIEdgeInsets.zero) let scrollView: UIScrollView = UIScrollView(wrapping: mainStackView, withInsets: UIEdgeInsets.zero)
scrollView.showsVerticalScrollIndicator = false scrollView.showsVerticalScrollIndicator = false
scrollView.delegate = self scrollView.delegate = self
view.addSubview(scrollView) view.addSubview(scrollView)
scrollView.set(.width, to: UIScreen.main.bounds.width)
scrollView.pin(to: view) scrollView.pin(to: view)
view.addSubview(fadeView) view.addSubview(fadeView)

Loading…
Cancel
Save