问题
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:
Here are some suggestions for you:
If you set image programatically than check image name spelling, It should be match exactly with bundle image name(case sensitive).
You have to add two images in your bundle. e.g if image name is
nature.pngthan you must have to addnature.pngandnature@2x.png(@2ximage must have double size than normal).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.
If you set image as
UIButtonimage with title than it is requited to set title and image insets, If title text is big or image size is bigger.
来源:https://stackoverflow.com/questions/24908239/cant-set-background-for-buttons-ios