I recently had to turn on Auto Layout for the storyboard in my project. This affected a view that I hoped it would not. The view I am describing has many UILabels
and they are positioned programmatically based on whether there is an image present in the view. However, now my programmatic positioning code does nothing, and the labels stay where they were placed on the view in the storyboard regardless. To get around this, I tried an animation in viewDidLoad
, which did nothing:
[UIView animateWithDuration:0.5 animations:^{
label1.frame = CGRectMake(10, baseY, 300, 50);
label2.frame = CGRectMake(10, baseY+35, 300, 50);
label3.frame = CGRectMake(10, baseY+60, 300, 50);
label4.frame = CGRectMake(10, baseY+85, 300, 50);
label5.frame = CGRectMake(10, baseY+110, 300, 50);
label6.frame = CGRectMake(10, baseY+135, 300, 50);
label7.frame = CGRectMake(10, baseY+180, 300, 175);
}];
Is there a way that I can programmatically reposition my labels without interfering with Auto Layout?