简体   繁体   English

如何在iOS中声明weakSelf对象

[英]How to declare a weakSelf object in iOS

What's the difference between: 之间有什么区别:

__weak __typeof(&*self)weakSelf = self

and

__weak __typeof(self)weakSelf = self

anyone know this? 有人知道吗?

Use 0xced's answer: 使用0xced的答案:

In the latest clang version Apple clang version 4.0 (tags/Apple/clang-421.1.48) (based on LLVM 3.1svn), ie Xcode 4.4+, the __typeof__((__typeof__(self))self) trick is not necessary anymore. 在最新的clang版本中,Apple clang版本4.0(标签/Apple/clang-421.1.48)(基于LLVM 3.1svn),即Xcode 4.4+, __typeof__((__typeof__(self))self)技巧。 The __weak typeof(self) bself = self; __weak typeof(self) bself = self; line will compile just fine. 行将编译就好了。

https://stackoverflow.com/a/11226768/630195 https://stackoverflow.com/a/11226768/630195

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM