Set a button background image iPhone programmatically

后端 未结 8 427
无人及你
无人及你 2020-12-13 14:25

In Xcode, how do you set the background of a UIButton as an image? Or, how can you set a background gradient in the UIButton?

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 15:20

    Code for background image of a Button in Swift 3.0

    buttonName.setBackgroundImage(UIImage(named: "facebook.png"), for: .normal)

    Hope this will help someone.

提交回复
热议问题