I have solved this problem.
I use the NSNotification function in the subview viewController class, in the viewWillAppear method, this is my implementation:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(deviceRotated:)
name:UIDeviceOrientationDidChangeNotification
object:[UIDevice currentDevice]];
and then, this is the deviceRotated method :
-(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);
}
}
Finally, the problem is solved. And this is the link that help me.