Post

Replies

Boosts

Views

Activity

Reply to ScrollView won't scroll
Almost, but thanks A BUNCH for pointing me in the right direction! This is the working solution:  scrollView = UIScrollView.init(frame: CGRect.zero)     scrollView.translatesAutoresizingMaskIntoConstraints = false     scrollView.isUserInteractionEnabled = true     scrollView.isScrollEnabled = true     self.view.addSubview(scrollView)     NSLayoutConstraint.activate([          scrollView.topAnchor.constraint(equalTo: self.titleHeader.bottomAnchor, constant: 10.0),          scrollView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),          scrollView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),          scrollView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),        ])                 var leadingAnchor = self.scrollView!.topAnchor     for i in 0..<20{       let t_button = UIButton.init(frame: CGRect.zero)       t_button.translatesAutoresizingMaskIntoConstraints = false       t_button.backgroundColor = UIColor.blue       scrollView.addSubview(t_button)       NSLayoutConstraint.activate([         t_button.topAnchor.constraint(equalTo: leadingAnchor, constant:5.0),         t_button.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor),         t_button.heightAnchor.constraint(equalToConstant: 50.0),         t_button.widthAnchor.constraint(equalToConstant: 75.0)       ])               leadingAnchor = t_button.bottomAnchor               t_button.setTitle("Button \(i)", for: .normal)       t_button.addTarget(self, action: #selector(scrollViewButtonAction(_:)), for: .touchUpInside)             }     leadingAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true
Dec ’20