Skip to content

Commit

Permalink
Merge pull request #3 from inscrutablemike/master
Browse files Browse the repository at this point in the history
- Fix LandscapeLeft offset calculations and a warning about deprecated s...

Former-commit-id: 2de1267
  • Loading branch information
hackiftekhar committed Sep 24, 2013
2 parents 1f6a874 + 98837e4 commit 4e22262
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 6 additions & 15 deletions KeyboardTextFieldDemo/IQKeyBoardManager/IQKeyBoardManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,21 @@ - (void)keyboardWillHide:(NSNotification*)aNotification
animationDuration = [[aNotification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
}

CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
CGRect resetFrame;

UIViewController *controller = [IQKeyBoardManager topMostController];

if([controller isKindOfClass:[UINavigationController class]])
{
appFrame = [[UIApplication sharedApplication] keyWindow].frame;
resetFrame = [[UIApplication sharedApplication] keyWindow].frame;
}
else
{
if ([controller modalPresentationStyle] == UIModalPresentationFormSheet ||
[controller modalPresentationStyle] == UIModalPresentationPageSheet)
{
appFrame.origin = CGPointZero;
appFrame.size = controller.view.frame.size;
}
else
{
appFrame.size = controller.view.frame.size;
}
resetFrame = CGRectMake(0, 0, controller.view.frame.size.width, controller.view.frame.size.height);
}

//Setting rootViewController frame to it's original position.
[self setRootViewFrame:appFrame];
[self setRootViewFrame:resetFrame];
}

//UIKeyboard Did shown. Adjusting RootViewController's frame according to device orientation.
Expand Down Expand Up @@ -273,7 +264,7 @@ -(void)keyboardWillShow:(NSNotification*)aNotification
switch (rootController.interfaceOrientation)
{
case UIInterfaceOrientationLandscapeLeft:
disturbDistance = CGRectGetMinX(rootViewRect)-CGRectGetMinX(appFrame);
disturbDistance = CGRectGetMinX(appFrame)-CGRectGetMinX(rootViewRect);
break;
case UIInterfaceOrientationLandscapeRight:
disturbDistance = CGRectGetMinX(appFrame)-CGRectGetMinX(rootViewRect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ -(id)initWithTarget:(id)target previousSelector:(SEL)pSelector nextSelector:(SEL

if (self)
{
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
[self setSegmentedControlStyle:UISegmentedControlStyleBar];
#endif
[self setMomentary:YES];
[self addTarget:self action:@selector(segmentedControlHandler:) forControlEvents:UIControlEventValueChanged];

Expand Down

0 comments on commit 4e22262

Please sign in to comment.