How to resize other subzones and parent view when resizing subtask

I have a view similar to a mail application. I also have a scroll view in that many other sub-items. When the user clicks on any text image, it expands to show the text in it. for example, the "in" field in the mail. I would like to resize the other subparagraphs so that they start below the expanded region. How should I do it.

I created the view through IB, and I marked it for a flexible top edge to facilitate this. But nothing happens automatically, and so I was wondering if I need to call sizethatFits / setneedsLayout.

+4
source share
1 answer

When resizing sub- [[self superview] setNeedsLayout] call [[self superview] setNeedsLayout] . In your supervisor, run -layoutSubviews to execute the actual layout. You will have to calculate everything yourself. Fixed / flexible fields are related to resizing the supervisor, not peer points. By default, -layoutSubviews does nothing; it is just called at the appropriate time.

If you need to make the layout happen at a specific point, you can call -layoutIfNeeded for yourself or your supervisor. Read the docs on how this method works. Generally speaking, you do not need to say this. It is usually called at the appropriate time if you just use -setNeedsLayout .

+6
source

All Articles