不能设置按钮的iOS背景 [英] Can't set Background for buttons iOS

查看:144
本文介绍了不能设置按钮的iOS背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用故事板的功能做了一个简单的应用程序。我已经取得了一些的UIButton 和我想改变我的的UIButton 调整背景。在故事板的背景下成功变化,但在实际的iOS模拟器我的背景不会改变。

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. 如果你比支票影像名字拼写设置图像编程,它应该是正好与包映像名称(区分大小写)匹配。

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

您必须在您的捆绑包添加两个图像。例如,如果映像名称是 nature.png 比你必须添加 nature.png nature@2x.png @ 2X 图像必须比正常两倍大小)。

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).

但如果你使用的是视网膜的设备比支票,你只在视网膜上的设备上运行你的应用程序只有一个图像,有时非视网膜设备将无法显示图像。

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.

如果您设置的图像作为的UIButton 以标题比它要求用设置标题和图像插入,如果标题文本是大还是图像尺寸更大的图像。

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.

这篇关于不能设置按钮的iOS背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆