我正在开发一个安装程序插件,目前看起来像这样:
目前我使用[self setNextEnabled:NO]
禁用“继续”按钮,直到输入所有字段。我希望能够做的是在单击下一个按钮时实际运行一些代码。在这里,我会ping服务器,如果我得到乒乓球,实际上只会转到下一个窗格。
我如何拥有此按钮的监听器?
我的代码有点像这样:
#import "MyInstallerPane.h"
@implementation MyInstallerPane
- (void)didEnterPane:(InstallerSectionDirection)dir{
[self toggleContinueButton];
[self initTempDir];
}
.. + my own functions..
答案 0 :(得分:2)
您可以覆盖委托方法
- (BOOL)shouldExitPane:(InstallerSectionDirection)dir;
如果需要阻止,则子类应覆盖此方法 InstallerPane退出。调用以确定是否应退出窗格 并允许另一个窗格显示在屏幕上。一旦InstallerPane 决定是时候退出,它可以调用gotoNextPane或 gotoPreviousPane退出而不再调用shouldExitPane。
例如:
- (BOOL)shouldExitPane:(InstallerSectionDirection)dir {
if (!good) {
return NO
}
return YES
}