How to rotate a uilabel in iOS 8

525 views Asked by At

I want to rotate a uiLabel and pin it to the right hand side of a container.

I add the constraints (trailing label to trailing container)

I then rotate the label:

[self.label setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];

Everything works fine in iOS 7. Here is a screen shot:

enter image description here

But in iso 8 the label is rotated differently. Here is a screen shot

enter image description here

1

There are 1 answers

1
Rob Sanders On

I have found that in iOS 8 you need to adjust your constraints when you animate views. Set up an IBOutlet the appropriate NSLayoutConstraints and change their constants before you reposition the view.