私が開発しているアプリは、ポートレート モードのみをサポートしています。ただし、iOS8 では、非推奨になっUIAlertView
た がランドスケープになり、その他の小さな問題が発生する可能性があります。これを修正するためにUIAlertController
、試してみることにしました。それは機能しますが、まだ少し面倒な新しい問題があります。アラートはランドスケープにはなりませんが、パララックス モーションが特徴です。のビューにラベルと画像を追加しましたUIAlertController
が、それらには視差機能がありません。つまり、ユーザーが電話を動かしたときにかなり奇妙に見えます。
2 つのオプションを探していますが、どちらも実行する方法が見つかりません。
最初の解決策は、アプリのどこでもサポートされていないことを確認して、視差を無効にすることです。
2 番目の解決策は、視差サポートをラベルと画像に追加することです。
とにかく、ここにコードがあります:
UIAlertController *welcomeAlertController = [UIAlertController
alertControllerWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Would you like to send %@ a message?", @"This message is displayed after adding a new message receiver. The %@ is the name of the receiver."), self.receiver.name]
message:@"\n\n\n\n\n\n\n\n"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Skip", @"Skip: meaning user can skip a certain step.")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
[self cancelButtonPressed];
}];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Send", @"Send: meaning user can send information to somewhere.")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
[self sendButtonClicked];
}];
[welcomeAlertController addAction:cancelAction];
[welcomeAlertController addAction:okAction];
smsView.frame = CGRectMake(20, 80, 240, 95);
messageBackgroundView.frame = CGRectMake(0, 0, 240, 80);
warningLabel.frame = CGRectMake(20, 170, 240, 40);
warningLabel.textColor = [UIColor blackColor];
[welcomeAlertController.view addSubview:smsView]; // An UIView
[welcomeAlertController.view addSubview:warningLabel];
[self presentViewController:welcomeAlertController animated:YES completion:nil];