UIView background color in Swift

后端 未结 8 1016
Happy的楠姐
Happy的楠姐 2020-12-25 09:51

Is there a way to set the UIView background color with Swift?

I know that in Objective-C, you would use self.view.backgroundColor = [UIColor redColor];,

8条回答
  •  失恋的感觉
    2020-12-25 10:33

    The response by @Miknash and @wolfgang gutierrez barrera was helpful to me. Only difference was I had to add rgbValue: to the function call.

    UIColorFromHex(rgbValue: 0xA6D632,alpha: 1 ) like so

提交回复
热议问题