- (IBAction)alertShow:(NSButton *)sender {
MHAlert* alert = [[MHAlert alloc]initWithMessageTitle:@"message" infoText:@"infoText" btnTitle:@"OK" target:self action:@selector(test:) secondBtnTitle:nil target:nil action:nil];
[alert runModal];
}
- (void)test:(void(^)(BOOL isSuccess))handler
{
if (handler) {
handler(YES);
}
else
{
handler(NO);
}
}
I want to pass a parameter by @selector(test:), and that is a block type parameter, I check the handler in test: method, and find it was not nil, when I do as code show. if not, how can I pass a nil value to test: method.
I don't want to use perform: method, or wrap a mew method after searching on net.