1
我遇到以下blog post解释的主题。但是,我对给定的样品有麻烦。测试目标 - 动作接线
它验证目标 - 动作像这样绑定:
STAssertEquals([doSomethingButton action], @selector(doSomething:),
@"The button should send -doSomething: to its target.");
STAssertEquals([doSomethingButton target], _windowController,
@"The button should send its action to the window controller.");
这工作只要doSomethingButton是UIBarButton。 UISwitch或UIButton没有目标或操作属性。我尝试了以下断言他们的目标 - 动作接线:
GHAssertNotNil([[controller logSwitch] actionsForTarget:controller forControlEvent:UIControlEventValueChanged], nil);
但是,它未能即使我已确认操作的模拟器正确调用。 UIControl的目标动作接线的正确方法是什么?
UPDATE:
UIControl - (NSSet *)allTargets
似乎即使调试应用程序,并在称为行动执行它没有返回,!