gpt4 book ai didi

swift - 如何编程更改使用 Interface Builder 创建的 UIImageView 中图像的高度/宽度?

转载 作者:搜寻专家 更新时间:2023-11-01 05:56:49 24 4
gpt4 key购买 nike

<分区>

代码如下:

  class ViewController: UIViewController {

@IBOutlet weak var border: UIImageView!


override func viewDidLoad() {
super.viewDidLoad()


let width = UIScreen.mainScreen().bounds.width

let height = UIScreen.mainScreen().bounds.height


border.image?.size.width = width
border.image?.size.height = height
}

但我收到一条错误消息:

cannot assign to property: size is a get only property

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com