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

super.contents = super.contents; 这个我看不懂~为啥要再赋值一遍 #18

Open
easyin999 opened this issue Apr 20, 2018 · 8 comments

Comments

@easyin999
Copy link

  • (void)display {

    //这个我看不懂~为啥要再赋值一遍
    super.contents = super.contents;

    [self _displayAsync:_displaysAsynchronously];

}

@ChenYalun
Copy link

Assigning a value to this property causes the layer to use your image rather than create a separate backing store.

@easyin999
Copy link
Author

Assigning a value to this property causes the layer to use your image rather than create a separate backing store.

Thx bro

@cntrump
Copy link

cntrump commented Mar 16, 2020

Texture 里的用法,_ASDisplayLayer.mm

- (void)_hackResetNeedsDisplay
{
  ASDisplayNodeAssertMainThread();
  // Don't listen to our subclasses crazy ideas about setContents by going through super
  super.contents = super.contents;
}

- (void)display
{
  ASDisplayNodeAssertMainThread();
  [self _hackResetNeedsDisplay];

  if (self.displaySuspended) {
    return;
  }

  [self display:self.displaysAsynchronously];
}

@lane128
Copy link

lane128 commented Dec 24, 2021

super 最后的消息接收者还是 'self'

@cntrump
Copy link

cntrump commented Dec 24, 2021

super 最后的消息接收者还是 'self'

super 就先从父类的方法开始找,找到就调用父类方法了。最后不会回到 self 的方法。

@lane128
Copy link

lane128 commented Jan 13, 2022

super 最后的消息接收者还是 'self'

super 就先从父类的方法开始找,找到就调用父类方法了。最后不会回到 self 的方法。

简单总结就是 ‘设置当前的contents为super.conents’

@jayying007
Copy link

super 最后的消息接收者还是 'self'

super 就先从父类的方法开始找,找到就调用父类方法了。最后不会回到 self 的方法。

简单总结就是 ‘设置当前的contents为super.conents’

如果是这样,为啥不是self.contents=super.contents

@cntrump
Copy link

cntrump commented Jun 12, 2022

如果是这样,为啥不是self.contents=super.contents

我猜作者是防止调到子类的 self.contents 搞出幺蛾子

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

5 participants