gpt4 book ai didi

objective-c - 我更改 UIBUtton 背景图像的方式有什么问题?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:56:45 25 4
gpt4 key购买 nike

让我们看看这张图:

enter image description here

左箭头显示按钮背景在 Interface Builder 中发生了变化,但在模拟器(和 iPhone)上它仍然是白色。

右边的箭头表示我已经更改了背景图片。

那么背景图片怎么没变呢?

此外,该界面构建器的背景参数是什么?我问的原因是,当您以编程方式设置背景图像时,您需要指定状态。

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIButton_Class/UIButton/UIButton.html

提示:图片太大了,你可以在firefox中用ctrl +放大:D

注意:我补充说:

  UIImage * imgFilterBar = [UIImage imageNamed:@"filter-bar.png"];
[self.ChangeFilter setBackgroundImage:imgFilterBar forState:UIControlStateNormal|UIControlStateHighlighted];

在viewDidLoad中

还是不行。

我收到了这个警告:2012-10-10 18:29:59.929 BadgerNew[29833:c07] 无法加载从带标识符的 bundle 中的 Nib 引用的“filter-bar.png”图像

这是什么意思?我在做 [UIImage imageNamed:@"filter-bar.png"];正确吗?该文件在我的项目中。

enter image description here

最佳答案

如果你想在 Button 上使用背景图像,请使用背景图像选项上方的图像选项。

关于objective-c - 我更改 UIBUtton 背景图像的方式有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12817827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com