I'm trying to rotate the titleLabel of a UIButton by 45 degrees. The character in the text is '+'.
I can get the title to rotate with
button.titleLabel?.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_4))
For anyone coming to this in the future, I ended up creating a new UIView (the blue rectangle) which contained the UIButton (the white '+'). I then disabled used interaction on the UIButton, and added a gesture recogniser to the UIView. When I wanted to rotate the '+', I rotated the whole UIButton (but not the containing UIView).