I'm turning my hand from years of Java / C++ / C to trying to learn Swift and how to develop on Apple.
I've tried a lot of tutorials and for what I want to achieve I need to use a splitview controller.
I need to have a few different detail views and can't work out how to do this via storyboard and thought I'd try to do it with code.
Following a tutorial and several google searches Im hitting a problem which I realise is me being a newbiee and ask for your help.
To keep things simple I created a test viewcontroller class and set it in the storyboard no problem.
import UIKit;
class tesctVC : UIViewController {
var scoreLabel: UILabel!
override func loadView() {
view = UIView()
view.backgroundColor = .white
scoreLabel = UILabel()
scoreLabel.translatesAutoresizingMaskIntoConstraints = false
scoreLabel.textAlignment = .right
scoreLabel.text = "Score: 0"
view.addSubview(scoreLabel)
// more code to come!
}
}
When I change to background color it shows as expected.
But when I try to add anything else, I've tried UILabels, UIButtons etc, they do not show.
Would you please give me some pointers?