Hello. Like the title says i am trying to creating a TextView. It is supposed to be in a UIView which already contains another UIView which poses as a fake top border. The border is where it is supposed to be, but the TextView won't show. Does anybody what i am doing wrong? Here is the code:
	let jobView = UIView.init(frame:CGRect.zero)
		 let topBorder = UIView.init(frame:CGRect.zero)
		 let jobTitleText = UITextView.init(frame:CGRect.zero)
		 jobView.translatesAutoresizingMaskIntoConstraints = false
		 topBorder.translatesAutoresizingMaskIntoConstraints = false
		 jobTitleText.translatesAutoresizingMaskIntoConstraints = false
		 jobTitleText.text = job.title
		 jobTitleText.textColor = UIColor.black
		 jobTitleText.font = UIFont.boldSystemFont(ofSize: 20)
		 jobView.addSubview(topBorder)
		 jobView.addSubview(jobTitleText)
		 NSLayoutConstraint.activate([
		 topBorder.topAnchor.constraint(equalTo: jobView.topAnchor),
		 topBorder.centerXAnchor.constraint(equalTo: jobView.centerXAnchor),
		 topBorder.heightAnchor.constraint(equalToConstant: 15.0),
		 topBorder.widthAnchor.constraint(equalTo: jobView.widthAnchor)
												])
												
		 NSLayoutConstraint.activate([
		 jobTitleText.topAnchor.constraint(equalTo: topBorder.bottomAnchor, constant: +5.0),
		 jobTitleText.heightAnchor.constraint(equalToConstant:25.0),
		 jobTitleText.leadingAnchor.constraint(equalTo: jobView.leadingAnchor, constant: +5),
Post
Replies
Boosts
Views
Activity
Hello.
I have successfully created a scrollview with several buttons that stack on top of one another. But the View won't scroll. What am i doing wrong here?
scrollView = UIScrollView.init(frame: CGRect.zero)
				scrollView.translatesAutoresizingMaskIntoConstraints = false
				
				
				self.view.addSubview(scrollView)
				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)
						
				}
				
				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),
				])