1

I am reading a matt's iOS book, when I read here, I have two place do not understand.

For a view’s underlying layer, layoutSublayers or layoutSublayers(of:) is called after the view’s layoutSubviews. Under autolayout, you must call super or else autolayout will break. Moreover, these methods may be called more than once during the course of autolayout; if you’re looking for an automatically generated signal that it’s time to do manual layout of sublayers, a view layout event might be a better choice.

  1. "you must call super or else autolayout will break", this phrase I can't understand.
  2. "if you’re looking for an automatically generated signal that it’s time to do manual layout of sublayers"

What mean of the two place?

5
  • 2
    "call super" probably means "invoke the equivalent superclass method". See What exactly is super in Objective-C?
    – Mick
    Dec 26, 2016 at 9:31
  • I'm guessing that "that it’s time to do" should read ", then it's time to do".
    – Mick
    Dec 26, 2016 at 9:41
  • @Mick, I know the super meaning, but I don't understand the must call super mean, and else autolayout will break , does it mean, if do not call super , the autolayout will not work? and if this, call super waht?
    – aircraft
    Dec 26, 2016 at 9:42
  • I'm guessing, since I don't know iOS programming, but it may mean that you should invoke the superclass method before you do anything in your own method. You should probably ask this on Stack Overflow.
    – Mick
    Dec 26, 2016 at 9:47
  • What mean of the two? Please.
    – Lambie
    Mar 29, 2017 at 22:39

1 Answer 1

1

"you must call super or else autolayout will break"

You must invoke the superclass constructor or the autolayout will not work. I have no idea why this is, or why it breaks formatting.

"if you’re looking for an automatically generated signal that it’s time to do manual layout of sublayers, a view layout event might be a better choice."

If you want an event to fire when it's time to invoke your method that manually lays out sublayers, you should use a "view layout event" (presumably instead of autolayout).

Again, no idea what he's talking about, but that's what it seems to mean. It's not very well-written, and certainly even more incomprehensible without the complete context.

Not the answer you're looking for? Browse other questions tagged .