Я решил эту проблему.
Я использую функцию NSNotification в классе viewController subview, в методе viewWillAppear, это моя реализация:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(deviceRotated:)
name:UIDeviceOrientationDidChangeNotification
object:[UIDevice currentDevice]];
и затем, это метод deviceRotated:
-(void)deviceRotated:(id)sender{
UIDeviceOrientation orientation = [[UIDevice currentDevice]orientation];
if (orientation == UIDeviceOrientationPortrait) {
CGAffineTransform rotate = CGAffineTransformMakeRotation (0.0);
CGAffineTransform translate = CGAffineTransformMakeTranslation(0, 30);
self.alertView.transform = CGAffineTransformConcat(translate, rotate);
}
else if (orientation == UIDeviceOrientationPortraitUpsideDown) {
CGAffineTransform rotate = CGAffineTransformMakeRotation (M_PI * 180 / 180.0f);
CGAffineTransform translate = CGAffineTransformMakeTranslation(-63, -100);
self.alertView.transform = CGAffineTransformConcat(translate, rotate);
}else if (orientation == UIDeviceOrientationLandscapeLeft) {
CGAffineTransform rotate = CGAffineTransformMakeRotation (M_PI * 90 / 180.0f);
CGAffineTransform translate = CGAffineTransformMakeTranslation(60, -180);
self.alertView.transform = CGAffineTransformConcat(translate, rotate);
}else if (orientation == UIDeviceOrientationLandscapeRight) {
CGAffineTransform rotate = CGAffineTransformMakeRotation ( M_PI * 270 / 180.0f);
CGAffineTransform translate = CGAffineTransformMakeTranslation(-60, -140);
self.alertView.transform = CGAffineTransformConcat(translate, rotate);
}
}
Наконец, проблема решена. И это - это ссылка, которая мне помогает.