本文介绍了什么是Objective-C中的"^"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
@implementation AppController
- (IBAction) loadComposition:(id)sender
{
void (^handler)(NSInteger);
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowedFileTypes:[NSArray arrayWithObjects: @"qtz", nil]];
handler = ^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
NSString *filePath = [[[panel URLs] objectAtIndex:0] path];
if (![qcView loadCompositionFromFile:filePath]) {
NSLog(@"Could not load composition");
}
}
};
[panel beginSheetModalForWindow:qcWindow completionHandler:handler];
}
@end
===我已经搜索了-是对内存的某种特定引用吗?
===I've searched and searched - is it some sort of particular reference to memory?
推荐答案
仔细阅读此处.它是一个块对象",基本上是lambda形式,被引入以支持Snow Leopard的GCD(大中央调度).
Read up on it here. It's a "Block object", which is basically a lambda form, and was introduced to support Snow Leopard's GCD (Grand Central Dispatch).
这篇关于什么是Objective-C中的"^"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!