gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 07:49:57 26 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/49969110/

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