Closed anzfactory closed 4 years ago
parallaxHeader.view
parallaxHeader.view.frame.width
import MXParallaxHeader import UIKit class ViewController: UIViewController { private let tableView: UITableView = { let tableView = UITableView(frame: .zero, style: .plain) tableView.translatesAutoresizingMaskIntoConstraints = false tableView.register(UITableViewCell.self, forCellReuseIdentifier: "CELL") return tableView }() private let coverView: UIView = { let view = UIView(frame: .zero) view.backgroundColor = .blue return view }() override func loadView() { super.loadView() tableView.dataSource = self view.addSubview(tableView) NSLayoutConstraint.activate([ tableView.topAnchor.constraint(equalTo: view.topAnchor), tableView.leftAnchor.constraint(equalTo: view.leftAnchor), tableView.rightAnchor.constraint(equalTo: view.rightAnchor), tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) } override func viewDidLoad() { super.viewDidLoad() tableView.parallaxHeader.mode = .fill tableView.parallaxHeader.view = coverView tableView.parallaxHeader.height = 300 tableView.parallaxHeader.minimumHeight = 10 } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) print(tableView.parallaxHeader.contentView.frame) // đŸ¤” (0.0, -344.0, 0.0, 344.0) print(tableView.parallaxHeader.view?.frame) // đŸ¤” Optional((0.0, 0.0, 0.0, 344.0)) } } extension ViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 100 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CELL", for: indexPath) cell.textLabel?.text = "Index: \(indexPath.row)" return cell } }
by MXParallaxHeader 1.0.0
expected behavior.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Issue Description
parallaxHeader.view
not filling superview.parallaxHeader.view.frame.width
is zero.Environment Information
Reproduction code
Screenshot
by MXParallaxHeader 1.0.0
expected behavior.