IPhone : Issue with presenting custom size ViewController modally in ios 8 with keyboard

on Tuesday, March 31, 2015

I am displaying a view controller modally with navigation controller in ipad with custom size, but when the keyboard show up the frame size of the view controller get changed, its work perfectly in ios7, having issue when run in iOS8


code to present view



UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controllerToShow];
navController.modalPresentationStyle = UIModalPresentationFormSheet;
[[AppDelgate instance].rootViewController presentViewController:navController animated:YES completion:nil];

//in opening viewcontroller class frame is set
#define view_height 400
#define view_width 700

-(void)viewWillAppear:(BOOL)animated{

if ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight) {
self.navigationController.view.superview.frame = CGRectMake(162, 200, view_width, view_height);
}else {
self.navigationController.view.superview.frame = CGRectMake(([AppDelgate instance].rootViewController.view.frame.size.width - 700)/2, 250, view_width, view_height);
}
}


Any idea on how to resolve this ?


0 comments:

Post a Comment