我有 2NSButton
秒,两者都是带边框的瞬时按下按钮。我有一个主窗口,其他视图被换入和换出。这两个按钮位于主窗口自定义视图(下一个,上一个)中,有助于在视图中导航。
当我在下一个按钮的帮助下到达 2 视图时,我使上一个按钮启用并可见。因此,如果此时我按下上一个按钮,第一个视图将被交换,我使上一个按钮透明并启用。
此时,如果您按下下一个按钮导航到第二个视图,则将换入第二个视图并再次显示上一个按钮。但在这里突出显示。我怎样才能摆脱这个?
我有 2NSButton
秒,两者都是带边框的瞬时按下按钮。我有一个主窗口,其他视图被换入和换出。这两个按钮位于主窗口自定义视图(下一个,上一个)中,有助于在视图中导航。
当我在下一个按钮的帮助下到达 2 视图时,我使上一个按钮启用并可见。因此,如果此时我按下上一个按钮,第一个视图将被交换,我使上一个按钮透明并启用。
此时,如果您按下下一个按钮导航到第二个视图,则将换入第二个视图并再次显示上一个按钮。但在这里突出显示。我怎样才能摆脱这个?
I hope you will get some better answers, but a general technique that I have found to work in cases like this is to wait with enable/disable actions until things have settled down for the new configuration of the views.
After all (if I have read your description correctly), you are hiding a button in the middle of its own action handler.
Postponing this is easily obtained by dispatching your enable/disable code on the next (or, more correctly, a later) invocation of the run loop of the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
// Enable or disable your buttons here.
});
As a solution it is somewhat of a hack, but on the other hand, waiting until your main view is no longer in a state of flux before you re-configure your navigation UI is not a bad approach.