How do I prevent a button's background image from stretching?

后端 未结 10 2018
执笔经年
执笔经年 2021-01-30 16:22

I\'m allocating a UIButtonTypeCustom UIButton to a UIView with a background image that is smaller than the button\'s frame. Reason why the image is smaller is because I\'m tryin

10条回答
  •  梦谈多话
    2021-01-30 16:55

    What you need to do is add your image as a UIImageView.

    Than add a button with transperent background (UIColor ClearColor) on top of it with your desired width and height.

提交回复
热议问题