Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改 GLEventHandler #5

Open
garryzhong opened this issue Oct 28, 2015 · 0 comments
Open

修改 GLEventHandler #5

garryzhong opened this issue Oct 28, 2015 · 0 comments

Comments

@garryzhong
Copy link

团队里有很多人,总有某些原因,或者没注意到,或是忘记了,或者懒,在 block 里强引用了 self。
所以我修改了 GLEventHandler,在 block 也可以放心使用 self,不必写那些烦人的 weakSelf。

typedef void (^GLEventHandler)(id self, GLEvent *event);

在调用 handler 时,self 弱引用 self(第一个 self 和 第二 self)并不是同一个东西,
那么在 block 的作用域内,self 都是弱引用的了,只是访问属性 要用 getter 和 setter 方法了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant