Chris Hansen
Chris Hansen

Reputation: 8639

Moving IBOutlet views

I have the following situation.

This code does not move the yearlyView or the benefitsView though. What I'm I doing wrong?

Upvotes: 0

Views: 36

Answers (1)

Duncan C
Duncan C

Reputation: 131471

There are severals ways to handle this.

Trying to manipulate the frames of your views is not one of those ways however. (Auto-layout generally ignores changes you make to the frame rectangles of the views it manages, and instead calculates new frames based on its constraints.)

It is possible to set up constraints for your views so that they shift over when you collapse one to zero size, but that is a bit of a pain.

Instead I would suggest using a stack view. Stack views are smart enough to close up the gap when you hide one of their subviews, and make room when you un-hide a view.

Upvotes: 1

Related Questions