I prefer to create my interfaces in code rather than using IB, but I wasn't able to change the font size of a UITextView that I'd created. Nothing was working at all. To try and debug the problem I added a UITextView to my main view using IB to see if that worked - and it did. The weird thing is that my programmatically created version also then worked, but only when the IB version is on the view. As soon as I delete it then the programmatically created version stops working - font size doesn't change.
Using traits, I can actually turn off the IB created version so that it's not installed and therefore never appears, which still allows the programmatically created version to work.
Anyone else seen this? Having a random element in IB isn't the end of the world, but it's frustrating and the sort of thing that will be difficult to explain/debug in the future.
fullWidthDetailText.isEditable = true
fullWidthDetailText.isSelectable = true
fullWidthDetailText.font = UIFont(name: "Roboto", size: 50)
fullWidthDetailText.adjustsFontForContentSizeCategory = false
fullWidthDetailText.text = "Hello world"
fullWidthDetailText.backgroundColor = UIColor.clear
fullWidthDetailText.textColor = UIColor.white
fullWidthDetailView.addSubview(fullWidthDetailText)