如何为 tvOS 创建背景颜色清晰的 UIButton?
How to create a UIButton for tvOS with a clear background color?
我正在尝试创建具有清晰背景色的系统类型的 UIButton。问题是即使我将它设置为 clearColor,它也会显示灰色背景色。我可以使用自定义类型的 UIButton 来实现,但是按钮失去了默认的聚焦和选择效果。
有谁知道如何创建具有完全透明背景的系统 UIButton?
在 Storyboard Attributes Inspector 中,您必须将按钮类型 System 更改为 Custom。
自 tvOS 11 以来,有一个解决方案,使用按钮类型 "plain" 而不是 "system",而不会失去聚焦和 selection 的效果:
在界面生成器中打开按钮属性 select "Type"->"Plain"
设置按钮背景颜色为"clear color"
就是这样。
在此处观看有关 "UIButtonTypePlain" 的苹果视频(从 13:44 开始):
UIButtonTypePlain explained
我正在尝试创建具有清晰背景色的系统类型的 UIButton。问题是即使我将它设置为 clearColor,它也会显示灰色背景色。我可以使用自定义类型的 UIButton 来实现,但是按钮失去了默认的聚焦和选择效果。
有谁知道如何创建具有完全透明背景的系统 UIButton?
在 Storyboard Attributes Inspector 中,您必须将按钮类型 System 更改为 Custom。
自 tvOS 11 以来,有一个解决方案,使用按钮类型 "plain" 而不是 "system",而不会失去聚焦和 selection 的效果:
在界面生成器中打开按钮属性 select "Type"->"Plain"
设置按钮背景颜色为"clear color"
就是这样。
在此处观看有关 "UIButtonTypePlain" 的苹果视频(从 13:44 开始): UIButtonTypePlain explained