Q:

Using autolayout from code with UIScrollView

I'm trying to use autolayout FROM CODE to correctly handle rotation in my UIScrollView that contains many UILabel generated at runtime for every page of a UIPageControl.  
I've not found so many examples, so i ask if anyone has examples about UIScrollView with autolayout with NSLayoutConstraints. 
EDITED
To be clearer: i create at runtime different UILabels and add them to UIScrollView.  In portrait it's:

(source: disclafani.org) 

While in landscape is wrong:

(source: disclafani.org) 

How can it be solved using autolayout?  I've tried using:
NSLayoutConstraint *cons1=[NSLayoutConstraint
constraintWithItem:label 
attribute:NSLayoutAttributeLeft          
relatedBy:NSLayoutRelationEqual 
toItem:label2 attribute:NSLayoutAttributeLeft 
multiplier:1.0 
constant:[UIScreen mainScreen].bounds.size.width*-1
                          ];

but it does not work and i don't think this is the right approach

A:

There are actually two quite different strategies, which Apple describes in great detail in this article, and which I illustrate in these two examples:

https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/iOS6bookExamples/ch20p573scrollViewAutoLayout
https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/iOS6bookExamples/ch20p573scrollViewAutoLayout2

Keep in mind, though, that UILabel is a very special case, because of its use of instrinsic size rules.  It is hard to say more without knowing more details of your case.