Merge pull request #3305 from vladyslav-iosdev/#3302

Cell height in Set Speed screen looks wrong #3302
pull/3310/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit caa2bbc068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      AlphaWallet/Transfer/ViewControllers/ConfigureTransactionViewController.swift
  2. 14
      AlphaWallet/Transfer/Views/GasSpeedTableViewCell.swift

@ -24,12 +24,16 @@ class ConfigureTransactionViewController: UIViewController {
weak var delegate: ConfigureTransactionViewControllerDelegate?
private lazy var tableView: UITableView = {
let tableView = UITableView()
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.register(GasSpeedTableViewCell.self)
tableView.registerHeaderFooterView(GasSpeedTableViewHeaderView.self)
tableView.tableFooterView = createTableFooter()
tableView.separatorStyle = .none
tableView.separatorStyle = .singleLine
tableView.separatorColor = R.color.mercury()
tableView.separatorInset = .zero
tableView.allowsSelection = true
tableView.rowHeight = UITableView.automaticDimension
return tableView
}()
@ -71,10 +75,9 @@ class ConfigureTransactionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
recalculateTotalFeeForCustomGas()
}
@ -453,7 +456,7 @@ extension ConfigureTransactionViewController: SliderTableViewCellDelegate {
extension ConfigureTransactionViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
return GasSpeedTableViewCell.height
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
@ -476,14 +479,14 @@ extension ConfigureTransactionViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
switch viewModel.sections[section] {
case .configurationTypes:
return 0.01
return .leastNormalMagnitude
case .gasLimit, .gasPrice:
return GasSpeedTableViewHeaderView.height
}
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
return .leastNormalMagnitude
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {

@ -8,11 +8,13 @@
import UIKit
class GasSpeedTableViewCell: UITableViewCell {
static let height: CGFloat = CGFloat(100)
private let estimatedTimeLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.numberOfLines = 0
label.numberOfLines = 0
return label
}()
@ -20,6 +22,7 @@ class GasSpeedTableViewCell: UITableViewCell {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.numberOfLines = 0
return label
}()
@ -51,10 +54,6 @@ class GasSpeedTableViewCell: UITableViewCell {
let row = [.spacerWidth(ScreenChecker().isNarrowScreen ? 8 : 16), col0, col1, .spacerWidth(ScreenChecker().isNarrowScreen ? 8 : 16)].asStackView(axis: .horizontal)
let separator = UIView()
separator.translatesAutoresizingMaskIntoConstraints = false
separator.backgroundColor = R.color.mercury()
let stackView = [
.spacer(height: ScreenChecker().isNarrowScreen ? 10 : 20),
row,
@ -64,14 +63,9 @@ class GasSpeedTableViewCell: UITableViewCell {
stackView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(stackView)
addSubview(separator)
NSLayoutConstraint.activate([
col1.widthAnchor.constraint(equalToConstant: 100),
separator.heightAnchor.constraint(equalToConstant: 1),
separator.leadingAnchor.constraint(equalTo: leadingAnchor),
separator.trailingAnchor.constraint(equalTo: trailingAnchor),
separator.bottomAnchor.constraint(equalTo: bottomAnchor),
stackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 0),
stackView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -30),

Loading…
Cancel
Save