我正在申请,我需要将屏幕旋转180度。为此,我在viewDidLoad方法 -
中使用此代码if(SYSTEM_VERSION_LESS_THAN(@"8.0"))
{
// iOS7
self.navigationController.view.transform=CGAffineTransformMakeRotation(M_PI_4*6);
}
else
{
self.navigationController.view.transform=CGAffineTransformMakeRotation(M_PI);
}
它适用于ViewController。问题是,当我尝试呈现alertViewController时,它对我不起作用。你可以在图像中看到 -
我尝试过尝试:
[self presentViewController:alertController animated:NO completion:^{
alertController.view.transform = CGAffineTransformMakeRotation(M_PI);
}];
我也尝试过:
[self presentViewController:alertController animated:NO completion:^{
alertController.view.transform = CGAffineTransformMakeRotation(-M_PI*2);
}];
我正在使用此方法来呈现UIAlertController -
-(void) showAlertWithNoAction:(NSString *) message and:(NSString *) title
{
if ([message isEqualToString:@"" ] || message ==nil) {
message = @"Some error occured!";
}
if([UIAlertController class])
{
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"OK action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:NO completion:^{
}];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[alert show];
}
}
我需要在点击按钮“接受”时显示警告消息,如屏幕截图所示。
请在旋转MainVC时帮助旋转UIAlertViewController。