Search code examples
iosuilabeluniversal

UIlabel text alignment for ipad and iphone


I am working on a universal app which has one label. When I rotate the screen, the label text alignment becomes different.


Solution

  • - (void) handleRotations:(UIRotationGestureRecognizer *)paramSender{
     if (self.helloWorldLabel == nil){
    }
    return;
    /* Take the previous rotation and add the current rotation to it */
    self.helloWorldLabel.transform = CGAffineTransformMakeRotation(self.rotationAngleInRadians +
    paramSender.rotation);
    /* At the end of the rotation, keep the angle for later use */ if (paramSender.state == UIGestureRecognizerStateEnded){
    }
    self.rotationAngleInRadians += paramSender.rotation;