Rotating a UIAlertView

前端 未结 1 564
臣服心动
臣服心动 2021-01-05 10:16

I\'ve created a custom UIAlertView (by subclassing it and messing around with its show function) that has some custom subviews and is of non-standard size.

相关标签:
1条回答
  • 2021-01-05 11:00

    Not sure if force rotating the UIAlertView fits the Apple GUI guidelines, but you can rotate it by defining the status bar (status bar and UIAlertView sticks together)

    application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
    application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
    

    But UIAlertView is a UIView just like many others, so try this :

    - (void)didPresentAlertView:(UIAlertView *)alertView
    {
        [UIView beginAnimations:@"" context:nil];
        [UIView setAnimationDuration:0.1];
        alertView.transform = CGAffineTransformRotate(alertView.transform, degreesToRadian(90));
        [UIView commitAnimations];
    }
    
    0 讨论(0)
提交回复
热议问题