iOS 8+ ,Objective-C
I'm working on UISplitViewController
and i'm implementing textFields on detailViewController. I have bottom View for extra two buttons, bottom view's height is 60px and width is depending on device rotation.
So, i want to know that how to get detailViewController's view's size when splitViewController's displayMode is UISplitViewControllerDisplayModeAllVisible
.
Any help will be appreciated.
EDIT:
i'm trying with following code in viewController,
#define TABBAR_HEIGHT 50.0f
#define NAVIGATION_HEIGHT 64.0f
#pragma mark- ScreenRotation
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[self calculateFrameForFooterView];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return YES;
}
- (BOOL)shouldAutorotate{
return YES;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (void)calculateFrameForFooterView{
//Caculate frame for footerView
[self addBarButton];
if(self.view.frame.size.width != frameClose.size.width){
frameClose = CGRectMake(0,footerView.frame.origin.y,self.view.frame.size.width,footerView.frame.size.height);
}
frameClose.origin.y = self.view.frame.size.height- footerView.frame.size.height;
CGFloat y;
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight){
NSLog(@"\n\n**(Landscap)self.view.frame.size(%@)",NSStringFromCGSize(self.view.frame.size));
frameClose.origin.y = self.view.frame.size.height- (footerView.frame.size.height);
y = self.view.frame.size.height-(KEYBOARD_HEIGHT+footerView.frame.size.height+TABBAR_HEIGHT+NAVIGATION_HEIGHT-20);
}else if(orientation == UIDeviceOrientationPortrait){
NSLog(@"\n\n**(Portrait)self.view.frame.size(%@)",NSStringFromCGSize(self.view.frame.size));
frameClose.origin.y = self.view.frame.size.height- (footerView.frame.size.height+TABBAR_HEIGHT+NAVIGATION_HEIGHT);
y = self.view.frame.size.height-(KEYBOARD_HEIGHT+TABBAR_HEIGHT+NAVIGATION_HEIGHT+footerView.frame.size.height);
}
frameOpen = CGRectMake(0,y,footerView.frame.size.width,footerView.frame.size.height);
}
alright, i solve my issue in - (void)viewWillLayoutSubviews{}
.
when i rotate the device this method called twice.in second time,i receive exact size.
so first of all,i remove - (void)calculateFrameForFooterView
from - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{}
than i put - (void)calculateFrameForFooterView
into - (void)viewWillLayoutSubviews{}
.
so, finally solved my issue by doing this. however,this solution is not perfect but this worked for me. so that i'm not accepting my own answer and waiting for good answer.
THANKS