私のiPhoneでは、ロード画面(UIView内のアクティビティインジケーター)を使用していましたが、今はアプリをユニバーサルアプリに変換しています。そのため、デバイスの向きに応じてロード画面を変更したいと考えています。コードを添付しました
-(void) loading
{
waitingBGView = [[UIView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 568.0)];
[waitingBGView setBackgroundColor:[UIColor blackColor]];
[waitingBGView setAlpha:0.5];
[appdelegate.window addSubview:waitingBGView];
smallBlackView = [[UIView alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width)/2 - 80, ([UIScreen mainScreen].bounds.size.height)/2 - 30, 160.0, 60.0)];
smallBlackView.layer.borderColor = [[UIColor whiteColor] CGColor];
smallBlackView.layer.borderWidth = 2.0;
smallBlackView.layer.cornerRadius = 7.0;
smallBlackView.backgroundColor = [UIColor blackColor];
activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[activityIndicator setFrame:CGRectMake(5.0, 5.0, 50.0, 50.0)];
[smallBlackView addSubview:activityIndicator];
[activityIndicator startAnimating];
UILabel *lblLoading = [[UILabel alloc]initWithFrame:CGRectMake(60.0, 0.0, 100.0, 60.0)];
lblLoading.backgroundColor = [UIColor clearColor];
lblLoading.font = [UIFont fontWithName:@"Helvetica" size:18.0];
lblLoading.textColor = [UIColor whiteColor];
lblLoading.text = @"Loading...";
[smallBlackView addSubview:lblLoading];
[appdelegate.window addSubview:smallBlackView];
}
デバイスの向きに応じてビューが変わるようにコードを変更する方法は?