ios – Objective-C ^运算符

我是Objective C中的新手,试图弄清楚^操作符是什么?在浏览一些源代码的同时,我看到下一个建设:
dispatch_once(&onceToken,^{
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(20.f,13.f),NO,0.0f);

    [[UIColor blackColor] setFill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0,20,1)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0,5,10,1)] fill];

    [[UIColor whiteColor] setFill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0,1,2)] fill];
    [[UIBezierPath bezierPathWithRect:CGRectMake(0,6,11,2)] fill];   

    defaultImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

});

我想知道什么是^?

解决方法

^表示Objective-C中块定义的开始.

看看这里:http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/bxGettingStarted.html#//apple_ref/doc/uid/TP40007502-CH7-SW1

请注意,在这种情况下,^不是运算符,它是Objective-C的语法的一部分@ Mike的投票答案严格是“^操作符”的正确定义

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...