gpt4 book ai didi

uibutton - 设置 UIButton 图像会导致 iOS 7 中的蓝色按钮

转载 作者:行者123 更新时间:2023-12-03 04:18:32 25 4
gpt4 key购买 nike

在 iOS 6 SDK 上,我编写了以下几行代码来在按钮内显示图像:

NSURL *thumbURL2 = [NSURL URLWithString:@"http://example.com/thumbs/2.jpg"];
NSData *thumbData2 = [NSData dataWithContentsOfURL:thumbURL2];
UIImage *thumb2 = [UIImage imageWithData:thumbData2];
[btn2 setImage:thumb2 forState:UIControlStateNormal];
[self.view addSubview:btn2];

但现在对于 Xcode 5 和 iOS 7 这不起作用。该按钮不包含图像。该按钮填充为蓝色。

最佳答案

在 iOS7 中,有一个名为 UIButtonTypeSystem NS_ENUM_AVAILABLE_IOS(7_0),//标准系统按钮的新按钮类型

检查您的 .xib 文件并将按钮类型更改为自定义 Look at the image

要以编程方式执行此操作,请将此行添加到 viewDidLoad 中:

[UIButton buttonWithType:UIButtonTypeSystem]; 

关于uibutton - 设置 UIButton 图像会导致 iOS 7 中的蓝色按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18133465/

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