我有一个表格视图,我希望自定义附件视图按钮。为此,我有带有半透明像素的自定义 PNG 图像。
UIButton *myAccessoryButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
[myAccessoryButton setUserInteractionEnabled:YES];
[myAccessoryButton setBackgroundColor:[UIColor clearColor]];
[myAccessoryButton setImage:[UIImage imageNamed:@"accessory_btn"] forState:UIControlStateNormal];
[myAccessoryButton addTarget: self
action: @selector(accessoryButtonTapped:withEvent:)
forControlEvents: UIControlEventTouchUpInside];
[cell setAccessoryView:myAccessoryButton];
这对我来说很好用按钮绘制,除了一个麻烦。在我的模板 (PSD) 中,此按钮具有混合模式 - 重叠,当我从 PSD 格式导出该按钮时,它具有白色半透明像素,必须以相同的重叠混合模式与表格背景混合。但默认情况下,当我将导出的 PNG 加载为 UIImage 以自定义我的附件视图时,它会在默认模式下混合。
如何更改 UIImage 或 UIButton 或 AccessoryView 的混合模式可能是?