gpt4 book ai didi

swift - Swift 中的 UIView 背景颜色

转载 作者:IT王子 更新时间:2023-10-29 04:59:37 26 4
gpt4 key购买 nike

有没有办法用 Swift 设置 UIView 背景颜色?

我知道在 Objective-C 中,您会使用 self.view.backgroundColor = [UIColor redColor];,但这在 Swift 中的工作方式不同。我环顾四周,因为 Swift 才大约一周大,我找不到答案。

有人有什么建议吗?

最佳答案

self.view.backgroundColor = UIColor.redColor()

在 Swift 3 中:

self.view.backgroundColor = UIColor.red

关于swift - Swift 中的 UIView 背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24112272/

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