gpt4 book ai didi

ios - 选择 UIButton 时,这个按钮人工制品是什么?

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

我正在尝试使用以下代码使 UI 按钮成为切换按钮:

- (void)tapButton:(id)sender{
UIButton *button = sender;
if (!button.selected){
[self performSelector:@selector(highlight:) withObject:button afterDelay:0.0];
}else{
[self performSelector:@selector(removeHighlight:) withObject:button afterDelay:0.0];
}
}

- (void)highlight:(UIButton *)button{
button.selected = !button.selected;
button.highlighted = YES;
}

- (void)removeHighlight:(UIButton *)button{
button.selected = !button.selected;
button.highlighted = NO;
}

但是,当按钮处于选定模式时,我得到了一个奇怪的人工制品。

未选中:

enter image description here

已选择:

enter image description here

最佳答案

只需将按钮类型设为“自定义”而不是“系统”即可。我猜这个奇怪的错误与 iOS7 上的新 Tint 功能有关。它可能有问题,因为您的 title 属性是一个空字符串 @"".

关于ios - 选择 UIButton 时,这个按钮人工制品是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17690601/

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