0

モーダルに表示しようとしているView Controllerがあります。画面上の特定の場所に移動する必要があります。以下のコードは、縦向きでは正常に動作しますが、横向きでは、中心をどのポイントに設定しても、ビューの位置がまったく変更されません。pcvc.landscapeView の代わりに pcvc.landscapeView.center を使用すると、ビューは再配置されますが、灰色のボックスがビューの元の位置に残り、ビューを操作できません。

横向きの場合、View Controller を別の方法で扱うにはどうすればよいですか?

PostCommentViewController *pcvc = [[PostCommentViewController alloc] initWithNibName:@"PostCommentViewController" bundle:nil];
pcvc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
pcvc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:(UIViewController *)pcvc animated:YES completion:nil];
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
{
    pcvc.portraitView.superview.frame = CGRectMake(0, 0, 750, 143);
    pcvc.portraitView.superview.center = CGPointMake(384, 680);
}
else
{
    pcvc.landscapeView.superview.frame = CGRectMake(0, 0, 683, 300);
    pcvc.landscapeView.superview.center = CGPointMake(500, 60);
}
4

1 に答える 1