Can't set Background for buttons iOS

2019-08-29 07:13发布

I made a simple app using the storyboard feature. I have made some UIButtons and I want to change the background of my UIButtons. In the storyboard the background successfully changes but in the actual iOS simulator my background does not change.

1条回答
相关推荐>>
2楼-- · 2019-08-29 07:41

Here are some suggestions for you:

  1. If you set image programatically than check image name spelling, It should be match exactly with bundle image name(case sensitive).

  2. You have to add two images in your bundle. e.g if image name is nature.png than you must have to add nature.png and nature@2x.png(@2x image must have double size than normal).

  3. Although if you are using only one image for retina devices than check that you run your application in only retina devices, Sometime non-retina device won't show image.

  4. If you set image as UIButton image with title than it is requited to set title and image insets, If title text is big or image size is bigger.

查看更多
登录 后发表回答