gpt4 book ai didi

ios - 点击 UIBar 按钮项目时的白色

转载 作者:可可西里 更新时间:2023-11-01 05:30:18 25 4
gpt4 key购买 nike

我使用下面的代码创建了一个自定义栏按钮项。

UIImage* image3 = [UIImage imageNamed:@"iphone-btn-next@2x.png"];
CGRect frameimg = CGRectMake(0, 0,57,44);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton setBackgroundImage:image3 forState:UIControlStateHighlighted];
[someButton addTarget:self action:@selector(flipView)
forControlEvents:UIControlEventTouchUpInside];
[someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *mailbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.rightBarButtonItem=mailbutton;

它工作正常,但问题是当我点击按钮时,我可以看到按钮中心的白色(见屏幕截图)。有人可以向我建议摆脱它的方法吗?

enter image description here

最佳答案

删除这行代码:

[someButton setShowsTouchWhenHighlighted:YES];

根据文档

showsTouchWhenHighlighted => A Boolean value that determines whether tapping the button causes it to glow.

关于ios - 点击 UIBar 按钮项目时的白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16930154/

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