【问题标题】:How to disable/hide action bar button icons in a pebble watch如何在卵石手表中禁用/隐藏操作栏按钮图标
【发布时间】:2014-10-16 04:59:52
【问题描述】:
我目前正在为我的 ios 应用程序开发一个 pebble 应用程序,该应用程序在操作栏上有三个媒体按钮。
现在在某些情况下,我必须禁用或隐藏 fastfarward/previous() 按钮,以便用户看不到它们。有人可以帮助我实现这一目标,因为 api 文档中没有适当的信息。
为了您的信息,我什至尝试调用“action_bar_layer_clear_icon”,但没有用。
【问题讨论】:
标签:
ios
pebble-watch
pebble-sdk
【解决方案1】:
使用 action_bar_layer_clear_icon 函数,您走在了正确的道路上。对于一些简单的示例代码,假设您在 CloudPebble 中创建了一个窗口布局:窗口“mywindow”包含操作栏层“s_actionbarlayer_1”(默认名称)。将选择按钮的图标上传为资源,并在首次显示布局时默认显示。然后,您可以通过从事件处理程序调用 action_bar_layer_clear_icon 在按下按钮时清除该图标:
void my_handler(void) {
action_bar_layer_clear_icon(s_actionbarlayer_1, BUTTON_ID_SELECT);
}
void my_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)my_handler);
}
int main(void) {
show_mywindow();
action_bar_layer_set_click_config_provider(s_actionbarlayer_1, my_config_provider);
app_event_loop();
}