我是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中块定义的开始.
请注意,在这种情况下,^不是运算符,它是Objective-C的语法的一部分@ Mike的投票答案严格是“^操作符”的正确定义
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。