ios - What is the caret symbol (^) and where is it defined? -
this question has answer here:
- caret in objective c 3 answers
i saw following code:
[uiview animatewithduration:5.0 animations:^ { iv.alpha = 1.0;//iv uiimageview }]; supposedly ^ defines function block or something. similar delegate? part of c/c++ or objective-c? cannot option+click symbol go in documentation.
the caret symbol creates block, similar delegate. it's type of closure—a function defined inline has access variables in parent scope, can used simplify types of delegate-/callback-oriented code.
Comments
Post a Comment