我想要发生的是矩形视图将调整标签的长度。这是我的代码
@IBOutlet weak var rectangleView: UIView!
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let stringNumber = "123ewrqrqwerw4"
let numberFromString = Int(stringNumber)
rectangleView.frame = CGRect(x: 15, y: 100, width: self.view.frame.width * numberFromString, height: 50)
self.label.text = stringNumber
}
但我的代码错了。