Can't set Background for buttons iOS

落爺英雄遲暮 提交于 2019-12-11 14:38:30

问题


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:

  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.



来源:https://stackoverflow.com/questions/24908239/cant-set-background-for-buttons-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!