Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 选择行时禁用uitableviewcell中的高亮显示按钮_Ios_Objective C_Uitableview_Cocoa Touch - Fatal编程技术网

Ios 选择行时禁用uitableviewcell中的高亮显示按钮

Ios 选择行时禁用uitableviewcell中的高亮显示按钮,ios,objective-c,uitableview,cocoa-touch,Ios,Objective C,Uitableview,Cocoa Touch,我有自定义UITableViewCell和两个按钮。当我选择行时,按钮的背景会改变为和所选行的背景相同的颜色,按钮的边框也会消失 选择行时,如何禁用更改按钮的边框/背景色 感谢您的回复,我使用了一个清晰的单元格背景视图并禁用了行的选择颜色,实现了这一点,但我需要这样做。不知道是否适合您的需要,但您可以尝试以下方法: UIView *selectedView = [[UIView alloc] initWithFrame:cell.bounds]; selectedView.backgroundC

我有自定义UITableViewCell和两个按钮。当我选择行时,按钮的背景会改变为和所选行的背景相同的颜色,按钮的边框也会消失

选择行时,如何禁用更改按钮的边框/背景色


感谢您的回复,我使用了一个清晰的单元格背景视图并禁用了行的选择颜色,实现了这一点,但我需要这样做。不知道是否适合您的需要,但您可以尝试以下方法:

UIView *selectedView = [[UIView alloc] initWithFrame:cell.bounds];
selectedView.backgroundColor = [UIColor clearColor];
cell.selectedBackgroundView = selectedView;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
希望这有帮助

也要签出此线程:

1)创建UIView并指定所需的背景色。 2) 将UIView渲染为UIImage 3) 将按钮的背景图像设置为所需状态

UIView *colorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
colorView.backgroundColor = color;

UIGraphicsBeginImageContext(colorView.bounds.size);
[colorView.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *colorImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[button setBackgroundImage:colorImage forState: UIControlStateHighlighted];