gpt4 book ai didi

ios - 如何将 UIImageView 放在 tableView 的中心

转载 作者:行者123 更新时间:2023-11-28 15:47:53 24 4
gpt4 key购买 nike

我希望我的图像位于 x 轴的中心,我正在编写这段代码:

let emptyImage=UIImageView(frame: CGRect(x: (UIScreen.main.bounds.width)/2 ,y: 200 , width: 50, height: 50))

但它不起作用。

最佳答案

试试这个

let emptyImage = UIImageView(frame: CGRect(x: UIScreen.main.bounds.width/2 - 50/2, y: 200, width: 50, height : 50)

关于ios - 如何将 UIImageView 放在 tableView 的中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42734609/

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