I know how to change the frame of a UILabel on rotation.
My question is, when a UILabel is a subView of another UIView, which is a subview of a paging enabled scrollView, is there a smart way to center the uilabel on rotation?
Consider This:
ScrollView --> 3 x UIView (3 pages) --> Each UIView has a UILabel subview.
In portrait all is fine, on rotate, i'm having to explicitly set the frame of each label.
I've tried adding:
[myLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
But this is not working, I just want the labels centred in the UIView no matter what the rotation. The UIViews already resize themselves correctly.
I did try to use something along the lines of:
[myLabel setCenter:CGPointMake(myView.frame.size.width / 2, myView.frame.size.height / 2)];
and placed this in the method: - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
However this isn't working well, as the UIViews are resized on rotation themselves.
Thanks