Objective c 目标C中的“^”是什么意思?
目标C中的字符是什么意思?就像下面的代码一样Objective c 目标C中的“^”是什么意思?,objective-c,Objective C,目标C中的字符是什么意思?就像下面的代码一样 TWTweetComposeViewControllerCompletionHandler completionHandler = ^(TWTweetComposeViewControllerResult result) { switch (result) { ... } [self dismissModalViewControllerAnima
TWTweetComposeViewControllerCompletionHandler
completionHandler =
^(TWTweetComposeViewControllerResult result) {
switch (result)
{
...
}
[self dismissModalViewControllerAnimated:YES];
};
它用作块定义的一部分:
^(return_type retval) {
statements;
}
您也可以将其视为块声明的一部分。这是一个“块”,您可以在中了解它,它主要用于多线程。它表示一个“块”,一段代码,可以打包到一个对象中,稍后使用。在您的示例中,它指定了稍后调用的完成处理程序,可能是在用户单击“OK”或类似按钮关闭警报时调用的
块还可以与Grand Central Dispatch一起使用,在这种情况下,它们用于生成可以在另一个线程上同步和异步运行的代码单元 这叫做插入符号。在C.10^4=14中也是按位异或。