同期画面の場合、ios5 で ModalViewController を作成しました。私はこのコードを使用しました:
synchViewController = [[SynchViewController alloc] initWithNibName:@"SynchViewController" bundle:nil];
synchViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:synchViewController animated:YES];
synchViewController.view.superview.frame = CGRectMake(0,0,SYNCHVIEW_WIDTH,SYNCHVIEW_HEIGHT);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGPoint center = CGPointMake(CGRectGetMidX(screenBounds), CGRectGetMidY(screenBounds));
synchViewController.view.superview.center = CGPointMake(center.y, center.x);
コントローラーは、xib ファイルで設計されました。このコードは機能しました。
現在、ios6 では、presentModalViewController は減価償却されています。メソッドを変更しましたが、モーダル ビュー コントローラーが完全に移動し、サイズが間違っています。
設計した xib レイアウトのサイズで iMessage ログイン画面のようなものを作成するにはどうすればよいですか?
編集: このコードで動作します: synchViewController = [[SynchViewController alloc] initWithNibName:@"SynchViewController" bundle:nil];
synchViewController.modalPresentationStyle = UIModalPresentationFormSheet;
synchViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:synchViewController animated:YES completion:nil];
synchViewController.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
synchViewController.view.superview.frame = CGRectMake(0,0,
SYNCHVIEW_WIDTH,// Width
SYNCHVIEW_HEIGHT// Height
);
synchViewController.view.superview.bounds = CGRectMake(0, 0, SYNCHVIEW_WIDTH, SYNCHVIEW_HEIGHT);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGPoint center = CGPointMake(CGRectGetMidX(screenBounds), CGRectGetMidY(screenBounds));
synchViewController.view.superview.center = CGPointMake(center.y, center.x);
ただし、アニメーションをYESに設定した場合のみ。アニメーションなしでロードしようとすると、再び完全に移動します。なぜですか?