//ScrollView Creation
var scrollviewsub = UIScrollView(frame: CGRect(x: 20, y: 40, width: Int(self.view.frame.size.width)-40, height: Int(self.view.frame.size.height) - 80))
scrollviewsub.layer.cornerRadius = 20.0
scrollviewsub.layer.masksToBounds = true
scrollviewsub.backgroundColor = UIColor.blue
scrollviewsub.isHidden = false
scrollviewsub.isScrollEnabled = true
self.view.addSubview(scrollviewsub)
self.view.bringSubview(toFront: scrollviewsub)
var scrollsub = 0
//Label Creation
let dynamicLabelsub = UILabel(frame: CGRect(x: 5, y: 5, width: 50, height: 30))
dynamicLabelsub.textColor = UIColor.black
dynamicLabelsub.backgroundColor = UIColor.black
dynamicLabelsub.textAlignment = NSTextAlignment.left
dynamicLabelsub.text = "\(self.num)" + "." + "\(questno) " + subque
dynamicLabelsub.tag = uniqueid
dynamicLabelsub.isHidden = false
dynamicLabelsub.numberOfLines = 0
dynamicLabelsub.sizeToFit()
// Label Insertion
scrollviewsub.addSubview(dynamicLabelsub)
scrollviewsub.bringSubview(toFront: dynamicLabelsub)
上面的代码显示了制作滚动视图(在屏幕上显示/显示)所涉及的过程。与scrollview不同的标签视图不会出现。知道为什么吗?