ios - 将 block 声明为 typedef
<p><p>我经常看到这样的 block 声明:</p>
<pre><code>typedef returnType (^TypeName)(parameterTypes);
</code></pre>
<p>我想知道,为什么我要将 block 声明为 typedef?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您这样做是为了减少拼写错误的可能性并使代码更具可读性。
举个极端的例子,请看我的回答:<a href="https://stackoverflow.com/questions/27162567/syntax-to-define-a-block-in-objective-c/27162860#27162860" rel="noreferrer noopener nofollow">Syntax to define a Block that takes a Block and returns a Block in Objective-C</a> </p></p>
<p style="font-size: 20px;">关于ios - 将 block 声明为 typedef,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/27254429/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/27254429/
</a>
</p>
页:
[1]