1
votes

I'm having a problem an auto layout problem with my UI

Contraints

At the bottom I have a container view with a height constraint of 0 which will contain some subviews at runtime. Also I have a IBOutlet to the container view's height constraint, at runtime when I know the height for the view, i set the height constraints constant property to the correct height. I want the super view to increase in size after the multiline detail labels text are set and the container views height constraint. What end up happening is the super view stays the same size and all the labels heights are decreased and the container view overlaps everything. Any help would be appreciated I've been at this for ages.

Thanks.

1
If you just set the frame from Code you should propably be able to manage container and subview's frames accordingly to fit your will..Finn Gaida
My understanding of auto layout is that you shouldn't set a views frame directly. Is this right?Darren Findlay
Well I had similar problems as well and since stopped using it so I guess you could have a point thereFinn Gaida
Yes, that is true -- you shouldn't set any frames when using auto layout. What constraints do you have on the superview?rdelmar
There are no constraints on the superview.Darren Findlay

1 Answers

0
votes

Do you call layoutIfNeeded after changing the constraint!? Your code should look something like:

[[self buttonEdgeConstraint] setConstant:200];
[UIView animateWithDuration:0.5 animations:^{
    [[self button] layoutIfNeeded];
}];