-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
{
dispatch_async(dispatch_get_main_queue(), ^{
[SecView setFrame:CGRectMake(0, 0, 480, 320)];
[self.view addSubview:SecView];
});
}
else {
dispatch_async(dispatch_get_main_queue(), ^{
[SecView removeFromSuperview];
});
}
{
if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
{
dispatch_async(dispatch_get_main_queue(), ^{
[SecView setFrame:CGRectMake(0, 0, 480, 320)];
[self.view addSubview:SecView];
});
}
else {
dispatch_async(dispatch_get_main_queue(), ^{
[SecView removeFromSuperview];
});
}
}
SecView是单独添加的视图,Orientation选Landscape。