UI Orientation problem when using UINavigationControoler/Navigation application
I have created a simple navigation application. I allow all orientations for the application. Problem is as follows I am in landscape orientation. then i navigate from RootViewController to a UIViewController For showing the PDF. When I am in UiviewControoler i change orientation to portrait. and come back to the RootViewController. At this time the RootViewController is in landscape mode itself and it Shows whole UI badly.
I really do not know what to search on net. still i tried to search but couldn't got my answer.Can anyone tell me How to fix t开发者_开发百科his problem?
First You declare Boolean type variable in app delegate file and then set property and synthesize in .m file. In app-delegate.m file u
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.isLandscapeLeft = TRUE;
}
else
{
MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.isLandscapeLeft = FALSE;
}
} in .m file u use this function which give u orientation is enable or not. similarly u do for view controller.
精彩评论