gpt4 book ai didi

iphone - 如何在 iphone 中以编程方式实现带有背景图像的按钮

转载 作者:IT王子 更新时间:2023-10-29 08:00:39 27 4
gpt4 key购买 nike

我正在 iPhone 中以编程方式使用按钮开发图像。现在我想为下一个和上一个按钮添加按钮背景图像。我想以编程方式为这些按钮添加图像。

如何在iphone中添加按钮图片。

最佳答案

//像这样添加按钮

UIImage *redButtonImage = [UIImage imageNamed:@"ExitButton.png"];

UIButton *redButton = [UIButton buttonWithType:UIButtonTypeCustom];
redButton.frame = CGRectMake(280.0, 10.0, 29.0, 29.0);
[redButton setBackgroundImage:redButtonImage forState:UIControlStateNormal];

[view addSubview:redButton];

关于iphone - 如何在 iphone 中以编程方式实现带有背景图像的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5012305/

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