Ändert den subView-Frame beim Drehen

Ich füge eine Unteransicht (Hintergrundansicht) in uiview in meinem Basisansichts-Controller hinzu. Sie funktioniert gut in Potratate, aber wenn ich die Ausrichtung von Potraite zu Querformat ändere, ist die Rahmengröße dieselbe wie bei Potrait. Ich möchte die Größe der Unteransicht beim Drehen ändern.

UIView *activityView = [[UIView alloc] initWithFrame:self.view.bounds];
CGRect frame = activityView.frame;
activityView.frame = frame;
activityView.backgroundColor = [UIColor clearColor];
activityView.alpha = 0.0f;
[self.view addSubview:activityView];
self.activityView = activityView;
UIView *backgroundView = [[UIView alloc]initWithFrame:activityView.bounds];
backgroundView.alpha = 0.0f;
[backgroundView setBackgroundColor:[UIColor lightGrayColor]];
[self.activityView backgroundView];
UIActivityIndicatorView *spinning = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[self.activityView spinning];
spinning.center = activityView.center;
self.activityView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
[spinning setColor:[UIColor lightGrayColor]];
[spinning startAnimating];

Antworten auf die Frage(2)

Ihre Antwort auf die Frage