ST意法半导体
直播中

tr4578

9年用户 1018经验值
擅长:模拟技术
私信 关注
[问答]

是否可以更改切换按钮状态?

是否可以更改切换按钮状态?








回帖(1)

安瑞娟

2022-12-1 16:10:33
是的,默认情况下,切换按钮会在您单击时做出反应,您可以使用此功能获取切换按钮的状态:


  • toggleButton1.getState()

如果你想自己设置一个状态,你可以使用这个函数:


  • toggleButton1.forceState(!toggleButton1.getState());
  • // here it will invert your toggle button state, so if true then false, and if false then true

我创建了一个小示例,您可以根据需要从中获得灵感。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分